|
1 |
| -import { schema, cfnLintAnnotations, typeDocs } from '@aws-cdk/cfnspec'; |
| 1 | +import { schema, cfnLintAnnotations } from '@aws-cdk/cfnspec'; |
2 | 2 | import { CodeMaker } from 'codemaker';
|
3 | 3 | import * as genspec from './genspec';
|
4 | 4 | import { itemTypeNames, PropertyAttributeName, scalarTypeNames, SpecName } from './spec-utils';
|
@@ -115,7 +115,7 @@ export default class CodeGenerator {
|
115 | 115 | const name = genspec.CodeName.forResourceProperties(resourceContext);
|
116 | 116 |
|
117 | 117 | this.docLink(spec.Documentation,
|
118 |
| - `Properties for defining a \`${resourceContext.className}\``, |
| 118 | + `Properties for defining a \`${resourceContext.specName!.fqn}\``, |
119 | 119 | '',
|
120 | 120 | '@stability external');
|
121 | 121 | this.code.openBlock(`export interface ${name.className}`);
|
@@ -144,17 +144,15 @@ export default class CodeGenerator {
|
144 | 144 | container: Container): Dictionary<string> {
|
145 | 145 | const propertyMap: Dictionary<string> = {};
|
146 | 146 |
|
147 |
| - const docs = typeDocs(resource.specName?.fqn ?? ''); |
148 |
| - |
149 | 147 | Object.keys(propertiesSpec).sort(propertyComparator).forEach(propName => {
|
150 | 148 | this.code.line();
|
151 | 149 | const propSpec = propertiesSpec[propName];
|
152 |
| - const additionalDocs = docs.properties[propName] || quoteCode(resource.specName!.relativeName(propName).fqn); |
| 150 | + const additionalDocs = resource.specName!.relativeName(propName).fqn; |
153 | 151 | const newName = this.emitProperty({
|
154 | 152 | context: resource,
|
155 | 153 | propName,
|
156 | 154 | spec: propSpec,
|
157 |
| - additionalDocs, |
| 155 | + additionalDocs: quoteCode(additionalDocs), |
158 | 156 | },
|
159 | 157 | container,
|
160 | 158 | );
|
@@ -194,20 +192,15 @@ export default class CodeGenerator {
|
194 | 192 | this.code.line();
|
195 | 193 | }
|
196 | 194 |
|
197 |
| - const docs = typeDocs(cfnName); |
198 |
| - |
199 | 195 | //
|
200 | 196 | // The class declaration representing this Resource
|
201 | 197 | //
|
202 | 198 |
|
203 |
| - this.docLink(spec.Documentation, ...[ |
| 199 | + this.docLink(spec.Documentation, |
204 | 200 | `A CloudFormation \`${cfnName}\``,
|
205 | 201 | '',
|
206 |
| - ...docs.description.split('\n'), |
207 |
| - '', |
208 | 202 | `@cloudformationResource ${cfnName}`,
|
209 |
| - '@stability external', |
210 |
| - ]); |
| 203 | + '@stability external'); |
211 | 204 | this.openClass(resourceName, RESOURCE_BASE_CLASS);
|
212 | 205 |
|
213 | 206 | //
|
@@ -278,9 +271,7 @@ export default class CodeGenerator {
|
278 | 271 |
|
279 | 272 | this.code.line();
|
280 | 273 |
|
281 |
| - this.docLink(undefined, |
282 |
| - docs.attributes?.[attributeName] ?? '', |
283 |
| - `@cloudformationAttribute ${attributeName}`); |
| 274 | + this.docLink(undefined, `@cloudformationAttribute ${attributeName}`); |
284 | 275 | const attr = genspec.attributeDefinition(attributeName, attributeSpec);
|
285 | 276 |
|
286 | 277 | this.code.line(`public readonly ${attr.propertyName}: ${attr.attributeType};`);
|
@@ -856,25 +847,18 @@ export default class CodeGenerator {
|
856 | 847 | this.code.line();
|
857 | 848 | this.beginNamespace(typeName);
|
858 | 849 |
|
859 |
| - const docs = typeDocs(resourceContext.specName?.fqn ?? '', (typeName.specName as PropertyAttributeName | undefined)?.propAttrName); |
860 |
| - |
861 |
| - this.docLink( |
862 |
| - propTypeSpec.Documentation, |
863 |
| - docs.description, |
864 |
| - '@stability external', |
865 |
| - ); |
| 850 | + this.docLink(propTypeSpec.Documentation, '@stability external'); |
866 | 851 | /*
|
867 | 852 | if (!propTypeSpec.Properties || Object.keys(propTypeSpec.Properties).length === 0) {
|
868 | 853 | this.code.line('// eslint-disable-next-line somethingsomething | A genuine empty-object type');
|
869 | 854 | }
|
870 | 855 | */
|
871 | 856 | this.code.openBlock(`export interface ${typeName.className}`);
|
872 | 857 | const conversionTable: Dictionary<string> = {};
|
873 |
| - |
874 | 858 | if (propTypeSpec.Properties) {
|
875 | 859 | Object.keys(propTypeSpec.Properties).forEach(propName => {
|
876 | 860 | const propSpec = propTypeSpec.Properties[propName];
|
877 |
| - const additionalDocs = docs.properties[propName] || quoteCode(`${typeName.fqn}.${propName}`); |
| 861 | + const additionalDocs = quoteCode(`${typeName.fqn}.${propName}`); |
878 | 862 | const newName = this.emitInterfaceProperty({
|
879 | 863 | context: resourceContext,
|
880 | 864 | propName,
|
@@ -966,23 +950,12 @@ export default class CodeGenerator {
|
966 | 950 | private docLink(link: string | undefined, ...before: string[]): void {
|
967 | 951 | if (!link && before.length === 0) { return; }
|
968 | 952 | this.code.line('/**');
|
969 |
| - before.flatMap(x => x.split('\n')).forEach(line => this.code.line(` * ${escapeDocText(line)}`.trimRight())); |
| 953 | + before.forEach(line => this.code.line(` * ${line}`.trimRight())); |
970 | 954 | if (link) {
|
971 |
| - if (before.length > 0) { |
972 |
| - this.code.line(' *'); |
973 |
| - } |
974 | 955 | this.code.line(` * @link ${link}`);
|
975 | 956 | }
|
976 | 957 | this.code.line(' */');
|
977 |
| - |
978 |
| - /** |
979 |
| - * If '* /' occurs literally somewhere in the doc text, it will break the docstring parsing. |
980 |
| - * |
981 |
| - * Break up those characters by inserting a zero-width space. |
982 |
| - */ |
983 |
| - function escapeDocText(x: string) { |
984 |
| - return x.replace(/\*\//g, '*\u200b/'); |
985 |
| - } |
| 958 | + return; |
986 | 959 | }
|
987 | 960 | }
|
988 | 961 |
|
|
0 commit comments