@cparra/apexdocs 2.8.2 → 2.9.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/openapi.json +474 -0
- package/examples/force-app/main/default/classes/ChildClass.cls +3 -1
- package/examples/force-app/main/default/classes/ParentClass.cls +4 -4
- package/examples/force-app/main/default/classes/SampleClass.cls +3 -0
- package/examples/force-app/main/default/restapi/SampleRestResource.cls +195 -0
- package/examples/force-app/main/default/restapi/SampleRestResourceWithInnerClass.cls +24 -0
- package/examples/force-app/main/default/restapi/references/Reference1.cls +9 -0
- package/examples/force-app/main/default/restapi/references/Reference2.cls +3 -0
- package/examples/force-app/main/default/restapi/references/Reference3.cls +3 -0
- package/examples/force-app/main/default/restapi/references/Reference4.cls +3 -0
- package/examples/force-app/main/default/restapi/references/Reference5.cls +3 -0
- package/examples/force-app/main/default/restapi/references/Reference6.cls +6 -0
- package/lib/application/Apexdocs.d.ts +1 -0
- package/lib/application/Apexdocs.js +33 -9
- package/lib/application/Apexdocs.js.map +1 -1
- package/lib/cli/generate.js +11 -3
- package/lib/cli/generate.js.map +1 -1
- package/lib/index.js +6 -2
- package/lib/index.js.map +1 -1
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.d.ts +7 -0
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js +14 -0
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js.map +1 -0
- package/lib/model/inheritance.d.ts +5 -5
- package/lib/model/manifest.d.ts +1 -1
- package/lib/model/markdown-file.d.ts +2 -2
- package/lib/model/markdown-file.js +2 -2
- package/lib/model/markdown-file.js.map +1 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +1 -1
- package/lib/model/markdown-generation-util/field-declaration-util.js +2 -2
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/index.js +6 -2
- package/lib/model/markdown-generation-util/index.js.map +1 -1
- package/lib/model/markdown-generation-util/method-declaration-util.js +4 -4
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/type-declaration-util.js +2 -2
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -1
- package/lib/model/markdown-home-file.js +1 -1
- package/lib/model/markdown-home-file.js.map +1 -1
- package/lib/model/markdown-type-file.js +5 -5
- package/lib/model/markdown-type-file.js.map +1 -1
- package/lib/model/openapi/apex-doc-types.d.ts +18 -0
- package/lib/model/openapi/apex-doc-types.js +5 -0
- package/lib/model/openapi/apex-doc-types.js.map +1 -0
- package/lib/model/openapi/open-api-types.d.ts +87 -0
- package/lib/model/openapi/open-api-types.js +3 -0
- package/lib/model/openapi/open-api-types.js.map +1 -0
- package/lib/model/openapi/open-api.d.ts +15 -0
- package/lib/model/openapi/open-api.js +33 -0
- package/lib/model/openapi/open-api.js.map +1 -0
- package/lib/model/openapi/openapi-type-file.d.ts +7 -0
- package/lib/model/openapi/openapi-type-file.js +16 -0
- package/lib/model/openapi/openapi-type-file.js.map +1 -0
- package/lib/model/{file.d.ts → outputFile.d.ts} +1 -1
- package/lib/model/{file.js → outputFile.js} +4 -4
- package/lib/model/outputFile.js.map +1 -0
- package/lib/model/types-repository.d.ts +11 -3
- package/lib/model/types-repository.js +37 -5
- package/lib/model/types-repository.js.map +1 -1
- package/lib/service/file-writer.d.ts +2 -2
- package/lib/service/file-writer.js.map +1 -1
- package/lib/service/metadata-processor.js.map +1 -1
- package/lib/service/parser.d.ts +1 -1
- package/lib/settings.d.ts +4 -5
- package/lib/settings.js +5 -23
- package/lib/settings.js.map +1 -1
- package/lib/test-helpers/AnnotationBuilder.d.ts +12 -0
- package/lib/test-helpers/AnnotationBuilder.js +31 -0
- package/lib/test-helpers/AnnotationBuilder.js.map +1 -0
- package/lib/test-helpers/ClassMirrorBuilder.d.ts +18 -0
- package/lib/test-helpers/ClassMirrorBuilder.js +54 -0
- package/lib/test-helpers/ClassMirrorBuilder.js.map +1 -0
- package/lib/test-helpers/DocCommentAnnotationBuilder.d.ts +6 -0
- package/lib/test-helpers/DocCommentAnnotationBuilder.js +21 -0
- package/lib/test-helpers/DocCommentAnnotationBuilder.js.map +1 -0
- package/lib/test-helpers/DocCommentBuilder.d.ts +12 -0
- package/lib/test-helpers/DocCommentBuilder.js +38 -0
- package/lib/test-helpers/DocCommentBuilder.js.map +1 -0
- package/lib/test-helpers/FieldMirrorBuilder.d.ts +16 -0
- package/lib/test-helpers/FieldMirrorBuilder.js +48 -0
- package/lib/test-helpers/FieldMirrorBuilder.js.map +1 -0
- package/lib/test-helpers/MethodMirrorBuilder.d.ts +10 -0
- package/lib/test-helpers/MethodMirrorBuilder.js +37 -0
- package/lib/test-helpers/MethodMirrorBuilder.js.map +1 -0
- package/lib/test-helpers/SettingsBuilder.d.ts +8 -0
- package/lib/test-helpers/SettingsBuilder.js +24 -0
- package/lib/test-helpers/SettingsBuilder.js.map +1 -0
- package/lib/transpiler/factory.d.ts +6 -0
- package/lib/transpiler/factory.js +32 -0
- package/lib/transpiler/factory.js.map +1 -0
- package/lib/transpiler/file-container.d.ts +4 -4
- package/lib/transpiler/file-container.js.map +1 -1
- package/lib/transpiler/generator-choices.d.ts +1 -0
- package/lib/transpiler/generator-choices.js +3 -0
- package/lib/transpiler/generator-choices.js.map +1 -0
- package/lib/transpiler/markdown/class-file-generatorHelper.js +4 -2
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -1
- package/lib/transpiler/openapi/open-api-docs-processor.d.ts +12 -0
- package/lib/transpiler/openapi/open-api-docs-processor.js +62 -0
- package/lib/transpiler/openapi/open-api-docs-processor.js.map +1 -0
- package/lib/transpiler/openapi/parsers/Builder.d.ts +16 -0
- package/lib/transpiler/openapi/parsers/Builder.js +30 -0
- package/lib/transpiler/openapi/parsers/Builder.js.map +1 -0
- package/lib/transpiler/openapi/parsers/MethodParser.d.ts +17 -0
- package/lib/transpiler/openapi/parsers/MethodParser.js +106 -0
- package/lib/transpiler/openapi/parsers/MethodParser.js.map +1 -0
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.d.ts +7 -0
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js +11 -0
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js.map +1 -0
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.d.ts +31 -0
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +161 -0
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js.map +1 -0
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.d.ts +10 -0
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js +20 -0
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js.map +1 -0
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.d.ts +7 -0
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js +18 -0
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js.map +1 -0
- package/lib/transpiler/processor-type-transpiler.d.ts +2 -2
- package/lib/transpiler/processor-type-transpiler.js +3 -0
- package/lib/transpiler/processor-type-transpiler.js.map +1 -1
- package/lib/transpiler/transpiler.js.map +1 -1
- package/lib/util/error-logger.js.map +1 -1
- package/package.json +8 -5
- package/src/application/Apexdocs.ts +37 -16
- package/src/cli/generate.ts +13 -4
- package/src/model/apex-type-wrappers/ClassMirrorWrapper.ts +12 -0
- package/src/model/apex-type-wrappers/__tests__/ClassMirrorWrapper.spec.ts +15 -0
- package/src/model/markdown-file.ts +2 -2
- package/src/model/markdown-generation-util/field-declaration-util.ts +5 -2
- package/src/model/markdown-generation-util/method-declaration-util.ts +5 -3
- package/src/model/markdown-generation-util/type-declaration-util.ts +1 -1
- package/src/model/openapi/__tests__/open-api.spec.ts +22 -0
- package/src/model/openapi/apex-doc-types.ts +25 -0
- package/src/model/openapi/open-api-types.ts +112 -0
- package/src/model/openapi/open-api.ts +39 -0
- package/src/model/openapi/openapi-type-file.ts +13 -0
- package/src/model/{file.ts → outputFile.ts} +1 -1
- package/src/model/types-repository.ts +48 -6
- package/src/service/file-writer.ts +2 -2
- package/src/settings.ts +8 -29
- package/src/test-helpers/AnnotationBuilder.ts +29 -0
- package/src/test-helpers/ClassMirrorBuilder.ts +56 -0
- package/src/test-helpers/DocCommentAnnotationBuilder.ts +18 -0
- package/src/test-helpers/DocCommentBuilder.ts +36 -0
- package/src/test-helpers/FieldMirrorBuilder.ts +52 -0
- package/src/test-helpers/MethodMirrorBuilder.ts +37 -0
- package/src/test-helpers/SettingsBuilder.ts +21 -0
- package/src/transpiler/factory.ts +33 -0
- package/src/transpiler/file-container.ts +4 -4
- package/src/transpiler/generator-choices.ts +1 -0
- package/src/transpiler/markdown/class-file-generatorHelper.ts +4 -2
- package/src/transpiler/openapi/__tests__/open-api-docs-processor.spec.ts +41 -0
- package/src/transpiler/openapi/open-api-docs-processor.ts +76 -0
- package/src/transpiler/openapi/parsers/Builder.ts +40 -0
- package/src/transpiler/openapi/parsers/MethodParser.ts +142 -0
- package/src/transpiler/openapi/parsers/ParameterObjectBuilder.ts +13 -0
- package/src/transpiler/openapi/parsers/ReferenceBuilder.ts +205 -0
- package/src/transpiler/openapi/parsers/RequestBodyBuilder.ts +19 -0
- package/src/transpiler/openapi/parsers/ResponsesBuilder.ts +17 -0
- package/src/transpiler/openapi/parsers/__tests__/MethodParser.spec.ts +44 -0
- package/src/transpiler/openapi/parsers/__tests__/ParameterObjectBuilder.spec.ts +68 -0
- package/src/transpiler/openapi/parsers/__tests__/ReferenceBuilder.spec.ts +622 -0
- package/src/transpiler/openapi/parsers/__tests__/RequestBodyBuilder.spec.ts +64 -0
- package/src/transpiler/openapi/parsers/__tests__/ResponsesBuilder.spec.ts +55 -0
- package/src/transpiler/processor-type-transpiler.ts +3 -1
- package/tsconfig.json +4 -1
- package/lib/model/file.js.map +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReferenceBuilder = void 0;
|
|
4
|
+
const types_repository_1 = require("../../../model/types-repository");
|
|
5
|
+
class ReferenceBuilder {
|
|
6
|
+
build(referencedTypeName) {
|
|
7
|
+
const [parsedReferencedType, isCollection] = this.handlePossibleCollectionReference(referencedTypeName);
|
|
8
|
+
const referencedTypeBundle = types_repository_1.TypesRepository.getInstance().getFromAllByName(parsedReferencedType);
|
|
9
|
+
if (!referencedTypeBundle) {
|
|
10
|
+
throw new Error(`The referenced type "${parsedReferencedType}" was not found.`);
|
|
11
|
+
}
|
|
12
|
+
if (referencedTypeBundle.type.type_name !== 'class') {
|
|
13
|
+
throw new Error(`Expected the referenced type to be a class, but found a ${referencedTypeBundle.type.type_name}.`);
|
|
14
|
+
}
|
|
15
|
+
const typeBundleWithIsCollection = Object.assign(Object.assign({}, referencedTypeBundle), { isCollection: isCollection });
|
|
16
|
+
return this.buildReferenceFromType(typeBundleWithIsCollection);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns a tuple where the first value is the name of the reference without any collection related values
|
|
20
|
+
* and the second is a boolean representing if we are dealing with a collection or not.
|
|
21
|
+
* @param referencedTypeName The received raw type name.
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
handlePossibleCollectionReference(referencedTypeName) {
|
|
25
|
+
referencedTypeName = referencedTypeName.toLowerCase();
|
|
26
|
+
if (referencedTypeName.startsWith('list<') && referencedTypeName.endsWith('>')) {
|
|
27
|
+
referencedTypeName = referencedTypeName.replace('list<', '');
|
|
28
|
+
referencedTypeName = referencedTypeName.replace('>', '');
|
|
29
|
+
return [referencedTypeName, true];
|
|
30
|
+
}
|
|
31
|
+
if (referencedTypeName.startsWith('set<') && referencedTypeName.endsWith('>')) {
|
|
32
|
+
referencedTypeName = referencedTypeName.replace('set<', '');
|
|
33
|
+
referencedTypeName = referencedTypeName.replace('>', '');
|
|
34
|
+
return [referencedTypeName, true];
|
|
35
|
+
}
|
|
36
|
+
return [referencedTypeName, false];
|
|
37
|
+
}
|
|
38
|
+
buildReferenceFromType(typeBundle) {
|
|
39
|
+
// Filtering based on Salesforce's documentation:
|
|
40
|
+
// https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm#ApexRESTUserDefinedTypes
|
|
41
|
+
// We assume that the class only contains object types allowed by Apex Rest:
|
|
42
|
+
// "Note that the public, private, or global class member variables must be types allowed by Apex REST"
|
|
43
|
+
const propertiesAndFields = [
|
|
44
|
+
...typeBundle.type.properties,
|
|
45
|
+
...typeBundle.type.fields,
|
|
46
|
+
]
|
|
47
|
+
.filter((current) => !current.memberModifiers.includes('static'))
|
|
48
|
+
.filter((current) => !current.memberModifiers.includes('transient'));
|
|
49
|
+
const properties = {};
|
|
50
|
+
let referencedComponents = [];
|
|
51
|
+
propertiesAndFields.forEach((current) => {
|
|
52
|
+
var _a;
|
|
53
|
+
const pair = this.getReferenceType(current.typeReference);
|
|
54
|
+
properties[current.name] = pair.schema;
|
|
55
|
+
properties[current.name].description = (_a = current.docComment) === null || _a === void 0 ? void 0 : _a.description;
|
|
56
|
+
pair.referenceComponents.forEach((current) => referencedComponents.push(current));
|
|
57
|
+
});
|
|
58
|
+
const mainReferenceComponents = this.buildMainReferenceComponent(typeBundle, properties);
|
|
59
|
+
// Make sure to add the "main" reference first
|
|
60
|
+
referencedComponents = [...mainReferenceComponents, ...referencedComponents];
|
|
61
|
+
return {
|
|
62
|
+
entrypointReferenceObject: {
|
|
63
|
+
$ref: `#/components/schemas/${this.getReferenceName(typeBundle)}`,
|
|
64
|
+
},
|
|
65
|
+
referenceComponents: referencedComponents,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
getReferenceName(typeBundle) {
|
|
69
|
+
var _a;
|
|
70
|
+
let referenceName = typeBundle.type.name;
|
|
71
|
+
if (typeBundle.isChild) {
|
|
72
|
+
referenceName = `${(_a = typeBundle.parentType) === null || _a === void 0 ? void 0 : _a.name}.${typeBundle.type.name}`;
|
|
73
|
+
}
|
|
74
|
+
if (typeBundle.isCollection) {
|
|
75
|
+
referenceName = `${referenceName}_array`;
|
|
76
|
+
}
|
|
77
|
+
return referenceName;
|
|
78
|
+
}
|
|
79
|
+
buildMainReferenceComponent(typeBundle, properties) {
|
|
80
|
+
// For the main reference, we always want to get the reference of the object without the collection part,
|
|
81
|
+
// so we pass the typeBundle to `getReferenceName` but with the isCollection flag set to false.
|
|
82
|
+
const mainReferenceName = this.getReferenceName(Object.assign(Object.assign({}, typeBundle), { isCollection: false }));
|
|
83
|
+
const mainReference = {
|
|
84
|
+
referencedClass: mainReferenceName,
|
|
85
|
+
schema: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: properties,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
const referencedComponents = [mainReference];
|
|
91
|
+
if (!typeBundle.isCollection) {
|
|
92
|
+
return referencedComponents;
|
|
93
|
+
}
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
referencedClass: this.getReferenceName(typeBundle),
|
|
97
|
+
schema: {
|
|
98
|
+
type: 'array',
|
|
99
|
+
items: {
|
|
100
|
+
$ref: `#/components/schemas/${mainReferenceName}`,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
...referencedComponents,
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
getReferenceType(typeInMirror) {
|
|
108
|
+
// Returns a valid type supported by OpenApi from a received Apex type.
|
|
109
|
+
const typeName = typeInMirror.type.toLowerCase();
|
|
110
|
+
switch (typeName) {
|
|
111
|
+
case 'boolean':
|
|
112
|
+
return { schema: { type: 'boolean' }, referenceComponents: [] };
|
|
113
|
+
case 'date':
|
|
114
|
+
return { schema: { type: 'string', format: 'date' }, referenceComponents: [] };
|
|
115
|
+
case 'datetime':
|
|
116
|
+
return { schema: { type: 'string', format: 'date-time' }, referenceComponents: [] };
|
|
117
|
+
case 'decimal':
|
|
118
|
+
return { schema: { type: 'number' }, referenceComponents: [] };
|
|
119
|
+
case 'double':
|
|
120
|
+
return { schema: { type: 'number' }, referenceComponents: [] };
|
|
121
|
+
case 'id':
|
|
122
|
+
return { schema: { type: 'string' }, referenceComponents: [] };
|
|
123
|
+
case 'integer':
|
|
124
|
+
return { schema: { type: 'integer' }, referenceComponents: [] };
|
|
125
|
+
case 'long':
|
|
126
|
+
return { schema: { type: 'integer', format: 'int64' }, referenceComponents: [] };
|
|
127
|
+
case 'string':
|
|
128
|
+
return { schema: { type: 'string' }, referenceComponents: [] };
|
|
129
|
+
case 'time':
|
|
130
|
+
return { schema: { type: 'string', format: 'time' }, referenceComponents: [] };
|
|
131
|
+
case 'list':
|
|
132
|
+
return this.buildCollectionPair(typeInMirror);
|
|
133
|
+
case 'set':
|
|
134
|
+
return this.buildCollectionPair(typeInMirror);
|
|
135
|
+
case 'map':
|
|
136
|
+
// For Maps, we treat them as objects but do not try to define their shape, because their keys can vary
|
|
137
|
+
// at runtime.
|
|
138
|
+
return { schema: { type: 'object' }, referenceComponents: [] };
|
|
139
|
+
default:
|
|
140
|
+
// If we got here we are dealing with a non-primitive (most likely a custom class or an SObject).
|
|
141
|
+
const referencedType = types_repository_1.TypesRepository.getInstance().getFromAllByName(typeName);
|
|
142
|
+
if (!referencedType) {
|
|
143
|
+
return { schema: { type: 'object' }, referenceComponents: [] };
|
|
144
|
+
}
|
|
145
|
+
const reference = this.buildReferenceFromType(Object.assign(Object.assign({}, referencedType), { isCollection: false }));
|
|
146
|
+
return {
|
|
147
|
+
schema: reference.entrypointReferenceObject,
|
|
148
|
+
referenceComponents: [...reference.referenceComponents],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
buildCollectionPair(typeInMirror) {
|
|
153
|
+
const innerReference = this.getReferenceType(typeInMirror.ofType);
|
|
154
|
+
return {
|
|
155
|
+
schema: { type: 'array', items: innerReference.schema },
|
|
156
|
+
referenceComponents: [...innerReference.referenceComponents],
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.ReferenceBuilder = ReferenceBuilder;
|
|
161
|
+
//# sourceMappingURL=ReferenceBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceBuilder.js","sourceRoot":"","sources":["../../../../src/transpiler/openapi/parsers/ReferenceBuilder.ts"],"names":[],"mappings":";;;AAOA,sEAA8E;AAM9E,MAAa,gBAAgB;IAC3B,KAAK,CAAC,kBAA0B;QAC9B,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAAC,GAAG,IAAI,CAAC,iCAAiC,CAAC,kBAAkB,CAAC,CAAC;QACxG,MAAM,oBAAoB,GAAG,kCAAe,CAAC,WAAW,EAAE,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;QAElG,IAAI,CAAC,oBAAoB,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,wBAAwB,oBAAoB,kBAAkB,CAAC,CAAC;SACjF;QACD,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YACnD,MAAM,IAAI,KAAK,CACb,2DAA2D,oBAAoB,CAAC,IAAI,CAAC,SAAS,GAAG,CAClG,CAAC;SACH;QACD,MAAM,0BAA0B,mCAAQ,oBAAoB,KAAE,YAAY,EAAE,YAAY,GAAE,CAAC;QAC3F,OAAO,IAAI,CAAC,sBAAsB,CAAC,0BAA0B,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACK,iCAAiC,CAAC,kBAA0B;QAClE,kBAAkB,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QACtD,IAAI,kBAAkB,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC9E,kBAAkB,GAAG,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAC7D,kBAAkB,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACzD,OAAO,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,CAAC;iBACxD,CAAC;SACL;IACH,CAAC;IAEO,mBAAmB,CAAC,YAA4B;QACtD,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAE,YAA+B,CAAC,MAAM,CAAC,CAAC;QACtF,OAAO;YACL,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE;YACvD,mBAAmB,EAAE,CAAC,GAAG,cAAc,CAAC,mBAAmB,CAAC;SAC7D,CAAC;IACJ,CAAC;CACF;AAzKD,4CAyKC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RequestBody } from '../../../model/openapi/open-api-types';
|
|
2
|
+
import { Reference } from './ReferenceBuilder';
|
|
3
|
+
import { ApexDocHttpRequestBody } from '../../../model/openapi/apex-doc-types';
|
|
4
|
+
import { Builder } from './Builder';
|
|
5
|
+
/**
|
|
6
|
+
* Parses and builds OpenApi Request Body objects.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RequestBodyBuilder extends Builder<RequestBody, ApexDocHttpRequestBody> {
|
|
9
|
+
buildBody(apexRequestBody: ApexDocHttpRequestBody, reference?: Reference): RequestBody;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestBodyBuilder = void 0;
|
|
4
|
+
const Builder_1 = require("./Builder");
|
|
5
|
+
/**
|
|
6
|
+
* Parses and builds OpenApi Request Body objects.
|
|
7
|
+
*/
|
|
8
|
+
class RequestBodyBuilder extends Builder_1.Builder {
|
|
9
|
+
buildBody(apexRequestBody, reference) {
|
|
10
|
+
return {
|
|
11
|
+
description: apexRequestBody.description,
|
|
12
|
+
content: {
|
|
13
|
+
'application/json': { schema: this.getOpenApiSchemaFromApexDocSchema(apexRequestBody, reference) },
|
|
14
|
+
},
|
|
15
|
+
required: apexRequestBody.required,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.RequestBodyBuilder = RequestBodyBuilder;
|
|
20
|
+
//# sourceMappingURL=RequestBodyBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestBodyBuilder.js","sourceRoot":"","sources":["../../../../src/transpiler/openapi/parsers/RequestBodyBuilder.ts"],"names":[],"mappings":";;;AAGA,uCAAoC;AAEpC;;GAEG;AACH,MAAa,kBAAmB,SAAQ,iBAA4C;IAClF,SAAS,CAAC,eAAuC,EAAE,SAAqB;QACtE,OAAO;YACL,WAAW,EAAE,eAAe,CAAC,WAAW;YACxC,OAAO,EAAE;gBACP,kBAAkB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,iCAAiC,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE;aACnG;YACD,QAAQ,EAAE,eAAe,CAAC,QAAQ;SACnC,CAAC;IACJ,CAAC;CACF;AAVD,gDAUC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ResponseObject } from '../../../model/openapi/open-api-types';
|
|
2
|
+
import { Reference } from './ReferenceBuilder';
|
|
3
|
+
import { ApexDocHttpResponse } from '../../../model/openapi/apex-doc-types';
|
|
4
|
+
import { Builder } from './Builder';
|
|
5
|
+
export declare class ResponsesBuilder extends Builder<ResponseObject, ApexDocHttpResponse> {
|
|
6
|
+
buildBody(apexDocResponseDefinition: ApexDocHttpResponse, reference?: Reference): ResponseObject;
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResponsesBuilder = void 0;
|
|
4
|
+
const Builder_1 = require("./Builder");
|
|
5
|
+
class ResponsesBuilder extends Builder_1.Builder {
|
|
6
|
+
buildBody(apexDocResponseDefinition, reference) {
|
|
7
|
+
return {
|
|
8
|
+
description: `Status code ${apexDocResponseDefinition.statusCode}`,
|
|
9
|
+
content: {
|
|
10
|
+
'application/json': {
|
|
11
|
+
schema: this.getOpenApiSchemaFromApexDocSchema(apexDocResponseDefinition, reference),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ResponsesBuilder = ResponsesBuilder;
|
|
18
|
+
//# sourceMappingURL=ResponsesBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponsesBuilder.js","sourceRoot":"","sources":["../../../../src/transpiler/openapi/parsers/ResponsesBuilder.ts"],"names":[],"mappings":";;;AAGA,uCAAoC;AAEpC,MAAa,gBAAiB,SAAQ,iBAA4C;IAChF,SAAS,CAAC,yBAA8C,EAAE,SAAqB;QAC7E,OAAO;YACL,WAAW,EAAE,eAAe,yBAAyB,CAAC,UAAU,EAAE;YAClE,OAAO,EAAE;gBACP,kBAAkB,EAAE;oBAClB,MAAM,EAAE,IAAI,CAAC,iCAAiC,CAAC,yBAAyB,EAAE,SAAS,CAAC;iBACrF;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAXD,4CAWC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Type } from '@cparra/apex-reflection';
|
|
2
2
|
import { FileContainer } from './file-container';
|
|
3
|
-
export
|
|
3
|
+
export type LinkingStrategy = 'root-relative' | 'path-relative';
|
|
4
4
|
export default abstract class ProcessorTypeTranspiler {
|
|
5
5
|
onBeforeProcess: ((types: Type[]) => void) | undefined;
|
|
6
6
|
abstract onProcess(type: Type): void;
|
|
7
7
|
onAfterProcess: ((types: Type[]) => void) | undefined;
|
|
8
8
|
abstract fileBuilder(): FileContainer;
|
|
9
|
-
|
|
9
|
+
getLinkingStrategy(): LinkingStrategy;
|
|
10
10
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class ProcessorTypeTranspiler {
|
|
4
|
+
getLinkingStrategy() {
|
|
5
|
+
return 'root-relative';
|
|
6
|
+
}
|
|
4
7
|
}
|
|
5
8
|
exports.default = ProcessorTypeTranspiler;
|
|
6
9
|
//# sourceMappingURL=processor-type-transpiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor-type-transpiler.js","sourceRoot":"","sources":["../../src/transpiler/processor-type-transpiler.ts"],"names":[],"mappings":";;AAKA,MAA8B,uBAAuB;
|
|
1
|
+
{"version":3,"file":"processor-type-transpiler.js","sourceRoot":"","sources":["../../src/transpiler/processor-type-transpiler.ts"],"names":[],"mappings":";;AAKA,MAA8B,uBAAuB;IASnD,kBAAkB;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAZD,0CAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpiler.js","sourceRoot":"","sources":["../../src/transpiler/transpiler.ts"],"names":[],"mappings":";;AAEA,0CAAuC;AACvC,4CAAqC;AAErC,MAAqB,UAAU;IAC7B,MAAM,CAAC,QAAQ,CAAC,KAAa,EAAE,SAAkC;;QAC/D,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;YACtD,IAAI,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI;gBAAE,OAAO,CAAC,CAAC,CAAC;YAC/C,IAAI,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI;gBAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;QAEH,MAAA,SAAS,CAAC,eAAe
|
|
1
|
+
{"version":3,"file":"transpiler.js","sourceRoot":"","sources":["../../src/transpiler/transpiler.ts"],"names":[],"mappings":";;AAEA,0CAAuC;AACvC,4CAAqC;AAErC,MAAqB,UAAU;IAC7B,MAAM,CAAC,QAAQ,CAAC,KAAa,EAAE,SAAkC;;QAC/D,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,C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IACL,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,eAAgC;QACnE,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;;YAChD,IAAI,MAAA,aAAa,CAAC,UAAU,0CAAE,KAAK,EAAE;gBACnC,eAAM,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,IAAI,6CAA6C,CAAC,CAAC;gBACnF,eAAM,CAAC,KAAK,CAAC,YAAY,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;gBACpE,eAAM,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC7C,eAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;aACnD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,8BAwFC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0-alpha.1",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"docs:init": "docsify init docs",
|
|
26
26
|
"docs:serve": "docsify serve docs",
|
|
27
27
|
"execute:example": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private protected -g docsify --defaultGroupName \"Misc Group\"",
|
|
28
|
+
"execute:example:openapi": "node lib/cli/generate.js -s examples/force-app -t docs protected -g openapi --openApiTitle \"My REST Api 2\"",
|
|
28
29
|
"execute:example:index:only": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private -g docsify --indexOnly"
|
|
29
30
|
},
|
|
30
31
|
"author": "Cesar Parra",
|
|
@@ -36,11 +37,12 @@
|
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/html-entities": "^1.3.4",
|
|
38
39
|
"@types/jest": "^27.4.1",
|
|
40
|
+
"@types/js-yaml": "^4.0.5",
|
|
39
41
|
"@types/node": "^13.7.4",
|
|
40
42
|
"@types/shelljs": "^0.8.6",
|
|
41
43
|
"@types/yargs": "^15.0.3",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
43
|
-
"@typescript-eslint/parser": "^5.
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
|
45
|
+
"@typescript-eslint/parser": "^5.41.0",
|
|
44
46
|
"docsify": "^4.12.2",
|
|
45
47
|
"eslint": "^8.0.1",
|
|
46
48
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
"prettier": "^2.4.1",
|
|
52
54
|
"rimraf": "^3.0.2",
|
|
53
55
|
"ts-jest": "^27.1.3",
|
|
54
|
-
"typescript": "^
|
|
56
|
+
"typescript": "^4.8.4"
|
|
55
57
|
},
|
|
56
58
|
"husky": {
|
|
57
59
|
"hooks": {
|
|
@@ -64,9 +66,10 @@
|
|
|
64
66
|
]
|
|
65
67
|
},
|
|
66
68
|
"dependencies": {
|
|
67
|
-
"@cparra/apex-reflection": "
|
|
69
|
+
"@cparra/apex-reflection": "2.0.1",
|
|
68
70
|
"chalk": "^4.1.2",
|
|
69
71
|
"fast-xml-parser": "^4.0.1",
|
|
72
|
+
"js-yaml": "^4.1.0",
|
|
70
73
|
"log-update": "4.0.0",
|
|
71
74
|
"xss": "^1.0.11",
|
|
72
75
|
"yargs": "^16.0.3"
|
|
@@ -7,9 +7,11 @@ import { RawBodyParser } from '../service/parser';
|
|
|
7
7
|
import { Settings } from '../settings';
|
|
8
8
|
import Transpiler from '../transpiler/transpiler';
|
|
9
9
|
import { FileWriter } from '../service/file-writer';
|
|
10
|
-
import { TypesRepository } from '../model/types-repository';
|
|
11
10
|
import ErrorLogger from '../util/error-logger';
|
|
12
11
|
import ApexBundle from '../model/apex-bundle';
|
|
12
|
+
import Manifest from '../model/manifest';
|
|
13
|
+
import { TypesRepository } from '../model/types-repository';
|
|
14
|
+
import { TypeTranspilerFactory } from '../transpiler/factory';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Application entry-point to generate documentation out of Apex source files.
|
|
@@ -22,21 +24,10 @@ export class Apexdocs {
|
|
|
22
24
|
Logger.log('Initializing...');
|
|
23
25
|
const fileBodies = ApexFileReader.processFiles(new DefaultFileSystem());
|
|
24
26
|
const manifest = createManifest(new RawBodyParser(fileBodies), this._reflectionWithLogger);
|
|
25
|
-
|
|
26
|
-
const filteredTypes
|
|
27
|
-
TypesRepository.getInstance().
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Logger.logSingle(
|
|
31
|
-
`Filtered ${manifest.types.length - filteredTypes.length} file(s) based on scope: ${
|
|
32
|
-
Settings.getInstance().scope
|
|
33
|
-
}`,
|
|
34
|
-
false,
|
|
35
|
-
'green',
|
|
36
|
-
false,
|
|
37
|
-
);
|
|
38
|
-
Logger.logSingle(`Creating documentation for ${filteredTypes.length} file(s)`, false, 'green', false);
|
|
39
|
-
const processor = Settings.getInstance().typeTranspiler;
|
|
27
|
+
TypesRepository.getInstance().populateAll(manifest.types);
|
|
28
|
+
const filteredTypes = this.filterByScopes(manifest);
|
|
29
|
+
TypesRepository.getInstance().populateScoped(filteredTypes);
|
|
30
|
+
const processor = TypeTranspilerFactory.get(Settings.getInstance().targetGenerator);
|
|
40
31
|
Transpiler.generate(filteredTypes, processor);
|
|
41
32
|
const generatedFiles = processor.fileBuilder().files();
|
|
42
33
|
FileWriter.write(generatedFiles, (fileName: string) => {
|
|
@@ -47,6 +38,36 @@ export class Apexdocs {
|
|
|
47
38
|
ErrorLogger.logErrors(filteredTypes);
|
|
48
39
|
}
|
|
49
40
|
|
|
41
|
+
private static filterByScopes(manifest: Manifest) {
|
|
42
|
+
let filteredTypes: Type[];
|
|
43
|
+
let filteredLogMessage;
|
|
44
|
+
if (Settings.getInstance().config.targetGenerator !== 'openapi') {
|
|
45
|
+
filteredTypes = manifest.filteredByAccessModifierAndAnnotations(Settings.getInstance().scope);
|
|
46
|
+
filteredLogMessage = `Filtered ${manifest.types.length - filteredTypes.length} file(s) based on scope: ${
|
|
47
|
+
Settings.getInstance().scope
|
|
48
|
+
}`;
|
|
49
|
+
} else {
|
|
50
|
+
// If we are dealing with an OpenApi generator, we ignore the passed in access modifiers, and instead
|
|
51
|
+
// we only keep classes annotated as @RestResource
|
|
52
|
+
filteredTypes = manifest.filteredByAccessModifierAndAnnotations([
|
|
53
|
+
'restresource',
|
|
54
|
+
'httpdelete',
|
|
55
|
+
'httpget',
|
|
56
|
+
'httppatch',
|
|
57
|
+
'httppost',
|
|
58
|
+
'httpput',
|
|
59
|
+
]);
|
|
60
|
+
filteredLogMessage = `Filtered ${
|
|
61
|
+
manifest.types.length - filteredTypes.length
|
|
62
|
+
} file(s), only keeping classes annotated as @RestResource.`;
|
|
63
|
+
}
|
|
64
|
+
Logger.clear();
|
|
65
|
+
|
|
66
|
+
Logger.logSingle(filteredLogMessage, false, 'green', false);
|
|
67
|
+
Logger.logSingle(`Creating documentation for ${filteredTypes.length} file(s)`, false, 'green', false);
|
|
68
|
+
return filteredTypes;
|
|
69
|
+
}
|
|
70
|
+
|
|
50
71
|
static _reflectionWithLogger = (apexBundle: ApexBundle): ReflectionResult => {
|
|
51
72
|
const result = reflect(apexBundle.rawTypeContent);
|
|
52
73
|
if (result.error) {
|
package/src/cli/generate.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as yargs from 'yargs';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Settings } from '../settings';
|
|
5
5
|
import { Apexdocs } from '../application/Apexdocs';
|
|
6
|
+
import { GeneratorChoices } from '../transpiler/generator-choices';
|
|
6
7
|
|
|
7
8
|
const argv = yargs.options({
|
|
8
9
|
sourceDir: {
|
|
@@ -29,15 +30,17 @@ const argv = yargs.options({
|
|
|
29
30
|
default: ['global'],
|
|
30
31
|
describe:
|
|
31
32
|
'A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. ' +
|
|
32
|
-
'Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled'
|
|
33
|
+
'Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled. ' +
|
|
34
|
+
'Note that this setting is ignored if generating an OpenApi REST specification since that looks for classes annotated with @RestResource.',
|
|
33
35
|
},
|
|
34
36
|
targetGenerator: {
|
|
35
37
|
type: 'string',
|
|
36
38
|
alias: 'g',
|
|
37
39
|
default: 'jekyll',
|
|
38
|
-
choices: ['jekyll', 'docsify', 'plain-markdown'],
|
|
40
|
+
choices: ['jekyll', 'docsify', 'plain-markdown', 'openapi'],
|
|
39
41
|
describe:
|
|
40
|
-
'Define the static file generator for which the documents will be created.
|
|
42
|
+
'Define the static file generator for which the documents will be created. ' +
|
|
43
|
+
'Currently supports jekyll, docsify, plain markdown, and OpenAPI v3.1.0.',
|
|
41
44
|
},
|
|
42
45
|
indexOnly: {
|
|
43
46
|
type: 'boolean',
|
|
@@ -58,6 +61,11 @@ const argv = yargs.options({
|
|
|
58
61
|
'because otherwise the content within < and > would be treated as HTML tags and not shown in the output. ' +
|
|
59
62
|
'Content in @example blocks are never sanitized.',
|
|
60
63
|
},
|
|
64
|
+
openApiTitle: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: 'Apex REST Api',
|
|
67
|
+
describe: 'If using "openapi" as the target generator, this allows you to specify the OpenApi title value.',
|
|
68
|
+
},
|
|
61
69
|
}).argv;
|
|
62
70
|
|
|
63
71
|
Settings.build({
|
|
@@ -69,6 +77,7 @@ Settings.build({
|
|
|
69
77
|
indexOnly: argv.indexOnly,
|
|
70
78
|
defaultGroupName: argv.defaultGroupName,
|
|
71
79
|
sanitizeHtml: argv.sanitizeHtml,
|
|
80
|
+
openApiTitle: argv.openApiTitle,
|
|
72
81
|
});
|
|
73
82
|
|
|
74
83
|
Apexdocs.generate();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ClassMirror, MethodMirror } from '@cparra/apex-reflection';
|
|
2
|
+
|
|
3
|
+
export class ClassMirrorWrapper {
|
|
4
|
+
constructor(public classMirror: ClassMirror) {}
|
|
5
|
+
|
|
6
|
+
getMethodsByAnnotation(annotation: string): MethodMirror[] {
|
|
7
|
+
return this.classMirror.methods.filter((method) => this.hasAnnotation(method, annotation));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
private hasAnnotation = (method: MethodMirror, annotationName: string) =>
|
|
11
|
+
method.annotations.some((annotation) => annotation.name.toLowerCase() === annotationName);
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ClassMirrorBuilder } from '../../../test-helpers/ClassMirrorBuilder';
|
|
2
|
+
import { ClassMirrorWrapper } from '../ClassMirrorWrapper';
|
|
3
|
+
import { AnnotationBuilder } from '../../../test-helpers/AnnotationBuilder';
|
|
4
|
+
import { MethodMirrorBuilder } from '../../../test-helpers/MethodMirrorBuilder';
|
|
5
|
+
|
|
6
|
+
it('should return methods by annotation when they exist', function () {
|
|
7
|
+
const classMirror = new ClassMirrorBuilder()
|
|
8
|
+
.addMethod(new MethodMirrorBuilder().addAnnotation(new AnnotationBuilder().withName('httpget').build()).build())
|
|
9
|
+
.build();
|
|
10
|
+
|
|
11
|
+
const classMirrorWrapper = new ClassMirrorWrapper(classMirror);
|
|
12
|
+
const foundMethods = classMirrorWrapper.getMethodsByAnnotation('httpget');
|
|
13
|
+
|
|
14
|
+
expect(foundMethods.length).toBe(1);
|
|
15
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OutputFile } from './outputFile';
|
|
2
2
|
import ClassFileGeneratorHelper from '../transpiler/markdown/class-file-generatorHelper';
|
|
3
3
|
|
|
4
|
-
export class MarkdownFile extends
|
|
4
|
+
export class MarkdownFile extends OutputFile {
|
|
5
5
|
fileExtension(): string {
|
|
6
6
|
return '.md';
|
|
7
7
|
}
|
|
@@ -28,7 +28,10 @@ function addFieldSection(
|
|
|
28
28
|
grouped: boolean,
|
|
29
29
|
) {
|
|
30
30
|
if (!grouped) {
|
|
31
|
-
markdownFile.addTitle(
|
|
31
|
+
markdownFile.addTitle(
|
|
32
|
+
`\`${mirrorModel.name}\` → \`${mirrorModel.typeReference.rawDeclaration}\``,
|
|
33
|
+
startingHeadingLevel + 2,
|
|
34
|
+
);
|
|
32
35
|
markdownFile.addBlankLine();
|
|
33
36
|
if (mirrorModel.inherited) {
|
|
34
37
|
markdownFile.addText('*Inherited*');
|
|
@@ -62,7 +65,7 @@ function addFieldSection(
|
|
|
62
65
|
description = ` - ${mirrorModel.docComment?.description}`;
|
|
63
66
|
}
|
|
64
67
|
markdownFile.addListItem(
|
|
65
|
-
`\`${mirrorModel.name}\` → \`${mirrorModel.
|
|
68
|
+
`\`${mirrorModel.name}\` → \`${mirrorModel.typeReference.rawDeclaration}\` (*Inherited*) ${annotations} ${description}`,
|
|
66
69
|
);
|
|
67
70
|
markdownFile.addBlankLine();
|
|
68
71
|
}
|
|
@@ -68,7 +68,9 @@ function buildSignature(name: string, parameterAware: ParameterAware): string {
|
|
|
68
68
|
if (isMethod(parameterAware) && (parameterAware as MethodMirrorWithInheritance).memberModifiers.length) {
|
|
69
69
|
signature = (parameterAware as MethodMirrorWithInheritance).memberModifiers.join(' ') + ' ' + signature;
|
|
70
70
|
}
|
|
71
|
-
const signatureParameters = parameterAware.parameters.map(
|
|
71
|
+
const signatureParameters = parameterAware.parameters.map(
|
|
72
|
+
(param) => `${param.typeReference.rawDeclaration} ${param.name}`,
|
|
73
|
+
);
|
|
72
74
|
signature += signatureParameters.join(', ');
|
|
73
75
|
return `${signature})`;
|
|
74
76
|
}
|
|
@@ -108,7 +110,7 @@ function addReturns(
|
|
|
108
110
|
markdownFile.addBlankLine();
|
|
109
111
|
markdownFile.addText('**Type**');
|
|
110
112
|
markdownFile.addBlankLine();
|
|
111
|
-
markdownFile.addText(methodModel.
|
|
113
|
+
markdownFile.addText(methodModel.typeReference.rawDeclaration);
|
|
112
114
|
markdownFile.addBlankLine();
|
|
113
115
|
markdownFile.addText('**Description**');
|
|
114
116
|
markdownFile.addBlankLine();
|
|
@@ -146,5 +148,5 @@ function addExample(markdownFile: MarkdownFile, docCommentAware: DocCommentAware
|
|
|
146
148
|
function isMethod(
|
|
147
149
|
method: MethodMirrorWithInheritance | ConstructorMirror | ParameterAware,
|
|
148
150
|
): method is ConstructorMirror {
|
|
149
|
-
return (method as MethodMirrorWithInheritance).
|
|
151
|
+
return (method as MethodMirrorWithInheritance).typeReference.rawDeclaration !== undefined;
|
|
150
152
|
}
|
|
@@ -75,7 +75,7 @@ function addParent(markdownFile: MarkdownFile, classMirror: ClassMirror) {
|
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const parentType = TypesRepository.getInstance().
|
|
78
|
+
const parentType = TypesRepository.getInstance().getFromScopedByName(classMirror.extended_class);
|
|
79
79
|
if (!parentType) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OpenApi } from '../open-api';
|
|
2
|
+
|
|
3
|
+
it('should get created with a title and a version', function () {
|
|
4
|
+
const openApi = new OpenApi('Test Spec', '1.0.0');
|
|
5
|
+
|
|
6
|
+
expect(openApi.info.title).toBe('Test Spec');
|
|
7
|
+
expect(openApi.info.version).toBe('1.0.0');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should contain a single server, which points to the correct server URL', function () {
|
|
11
|
+
const openApi = new OpenApi('Test Spec', '1.0.0');
|
|
12
|
+
|
|
13
|
+
expect(openApi.servers.length).toBe(1);
|
|
14
|
+
expect(openApi.servers[0].url).toBe('/services/apexrest/');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should optionally allow for a namespace to be passed in as part of the server', function () {
|
|
18
|
+
const openApi = new OpenApi('Test Spec', '1.0.0', 'Namespace');
|
|
19
|
+
|
|
20
|
+
expect(openApi.servers.length).toBe(1);
|
|
21
|
+
expect(openApi.servers[0].url).toBe('/services/apexrest/Namespace/');
|
|
22
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// These are types that represent how the data is expected to be created in the ApexDoc (as YAML), which
|
|
2
|
+
// in some cases might be different from the official OpenApi spec for simplicity when writing the ApexDoc.
|
|
3
|
+
|
|
4
|
+
import { SchemaObjectArray, SchemaObjectObject } from './open-api-types';
|
|
5
|
+
|
|
6
|
+
export type ApexDocHttpResponse = {
|
|
7
|
+
statusCode: number;
|
|
8
|
+
schema: ApexDocSchemaObject;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ApexDocHttpRequestBody = {
|
|
12
|
+
description?: string;
|
|
13
|
+
schema: ApexDocSchemaObject;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ApexDocParameterObject = {
|
|
18
|
+
name: string;
|
|
19
|
+
in: 'query' | 'header' | 'path' | 'cookie';
|
|
20
|
+
description?: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
schema: ApexDocSchemaObject;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type ApexDocSchemaObject = SchemaObjectObject | SchemaObjectArray | string;
|