@cparra/apexdocs 2.8.0 → 2.9.0-alpha.0
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/Main/SampleClass.md +188 -188
- package/docs/openapi.json +351 -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/restapi/SampleRestResource.cls +189 -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.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 +1 -1
- 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 +6 -3
- package/lib/model/types-repository.js +12 -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 +14 -0
- package/lib/test-helpers/ClassMirrorBuilder.js +44 -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/MethodMirrorBuilder.d.ts +10 -0
- package/lib/test-helpers/MethodMirrorBuilder.js +34 -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 +104 -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 +16 -0
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +65 -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/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 +14 -5
- package/src/service/__tests__/apex-file-reader.spec.ts +4 -4
- package/src/service/__tests__/manifest-factory.spec.ts +2 -1
- 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 +44 -0
- package/src/test-helpers/DocCommentAnnotationBuilder.ts +18 -0
- package/src/test-helpers/DocCommentBuilder.ts +36 -0
- package/src/test-helpers/MethodMirrorBuilder.ts +34 -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 +140 -0
- package/src/transpiler/openapi/parsers/ParameterObjectBuilder.ts +13 -0
- package/src/transpiler/openapi/parsers/ReferenceBuilder.ts +80 -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 +64 -0
- package/src/transpiler/openapi/parsers/__tests__/ReferenceBuilder.spec.ts +14 -0
- package/src/transpiler/openapi/parsers/__tests__/RequestBodyBuilder.spec.ts +60 -0
- package/src/transpiler/openapi/parsers/__tests__/ResponsesBuilder.spec.ts +51 -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,351 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "My REST Api 2",
|
|
5
|
+
"version": "1.0.0"
|
|
6
|
+
},
|
|
7
|
+
"servers": [
|
|
8
|
+
{
|
|
9
|
+
"url": "/services/apexrest/"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"paths": {
|
|
13
|
+
"/Account/*": {
|
|
14
|
+
"description": "Account related operations.",
|
|
15
|
+
"get": {
|
|
16
|
+
"description": "This is a sample HTTP Get method",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"name": "limit",
|
|
20
|
+
"in": "query",
|
|
21
|
+
"required": true,
|
|
22
|
+
"description": "Limits the number of items on a page",
|
|
23
|
+
"schema": {
|
|
24
|
+
"type": "integer"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "complex",
|
|
29
|
+
"in": "cookie",
|
|
30
|
+
"description": "A more complex schema",
|
|
31
|
+
"schema": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"name": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"responses": {
|
|
45
|
+
"100": {
|
|
46
|
+
"description": "Status code 100",
|
|
47
|
+
"content": {
|
|
48
|
+
"application/json": {
|
|
49
|
+
"schema": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"anotherObject": {
|
|
53
|
+
"description": "An object inside of an object",
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"message": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
},
|
|
59
|
+
"somethingElse": {
|
|
60
|
+
"type": "number"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"200": {
|
|
70
|
+
"description": "Status code 200",
|
|
71
|
+
"content": {
|
|
72
|
+
"application/json": {
|
|
73
|
+
"schema": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"id": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "The super Id."
|
|
79
|
+
},
|
|
80
|
+
"name": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
},
|
|
83
|
+
"phone": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"format": "byte"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"304": {
|
|
93
|
+
"description": "Status code 304",
|
|
94
|
+
"content": {
|
|
95
|
+
"application/json": {
|
|
96
|
+
"schema": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"error": {
|
|
100
|
+
"type": "string"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"400": {
|
|
108
|
+
"description": "Status code 400",
|
|
109
|
+
"content": {
|
|
110
|
+
"application/json": {
|
|
111
|
+
"schema": {
|
|
112
|
+
"type": "array",
|
|
113
|
+
"items": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"properties": {
|
|
116
|
+
"name": {
|
|
117
|
+
"type": "string"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"500": {
|
|
126
|
+
"description": "Status code 500",
|
|
127
|
+
"content": {
|
|
128
|
+
"application/json": {
|
|
129
|
+
"schema": {
|
|
130
|
+
"type": "string"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"post": {
|
|
138
|
+
"description": "This is a sample HTTP Post method",
|
|
139
|
+
"requestBody": {
|
|
140
|
+
"description": "This is an example of a request body",
|
|
141
|
+
"content": {
|
|
142
|
+
"application/json": {
|
|
143
|
+
"schema": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"items": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"properties": {
|
|
148
|
+
"name": {
|
|
149
|
+
"type": "string"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"required": true
|
|
157
|
+
},
|
|
158
|
+
"parameters": [
|
|
159
|
+
{
|
|
160
|
+
"name": "limit",
|
|
161
|
+
"in": "query",
|
|
162
|
+
"required": true,
|
|
163
|
+
"description": "Limits the number of items on a page",
|
|
164
|
+
"schema": {
|
|
165
|
+
"type": "integer"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "complex",
|
|
170
|
+
"in": "cookie",
|
|
171
|
+
"description": "A more complex schema",
|
|
172
|
+
"schema": {
|
|
173
|
+
"type": "array",
|
|
174
|
+
"items": {
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"name": {
|
|
178
|
+
"type": "string"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"responses": {
|
|
186
|
+
"200": {
|
|
187
|
+
"description": "Status code 200",
|
|
188
|
+
"content": {
|
|
189
|
+
"application/json": {
|
|
190
|
+
"schema": {
|
|
191
|
+
"type": "object",
|
|
192
|
+
"properties": {
|
|
193
|
+
"id": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"description": "The super Id."
|
|
196
|
+
},
|
|
197
|
+
"name": {
|
|
198
|
+
"type": "string"
|
|
199
|
+
},
|
|
200
|
+
"phone": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"format": "byte"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"304": {
|
|
210
|
+
"description": "Status code 304",
|
|
211
|
+
"content": {
|
|
212
|
+
"application/json": {
|
|
213
|
+
"schema": {
|
|
214
|
+
"type": "object",
|
|
215
|
+
"properties": {
|
|
216
|
+
"error": {
|
|
217
|
+
"type": "string"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"400": {
|
|
225
|
+
"description": "Status code 400",
|
|
226
|
+
"content": {
|
|
227
|
+
"application/json": {
|
|
228
|
+
"schema": {
|
|
229
|
+
"type": "array",
|
|
230
|
+
"items": {
|
|
231
|
+
"type": "object",
|
|
232
|
+
"properties": {
|
|
233
|
+
"name": {
|
|
234
|
+
"type": "string"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"500": {
|
|
243
|
+
"description": "Status code 500",
|
|
244
|
+
"content": {
|
|
245
|
+
"application/json": {
|
|
246
|
+
"schema": {
|
|
247
|
+
"type": "string"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"delete": {
|
|
255
|
+
"description": "Sample HTTP Delete method with references to other types.",
|
|
256
|
+
"requestBody": {
|
|
257
|
+
"description": "This is an example of a request body",
|
|
258
|
+
"content": {
|
|
259
|
+
"application/json": {
|
|
260
|
+
"schema": {
|
|
261
|
+
"$ref": "#/components/schemas/SampleClass"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"required": true
|
|
266
|
+
},
|
|
267
|
+
"parameters": [
|
|
268
|
+
{
|
|
269
|
+
"name": "limit",
|
|
270
|
+
"in": "header",
|
|
271
|
+
"required": true,
|
|
272
|
+
"description": "My sample description.",
|
|
273
|
+
"schema": {
|
|
274
|
+
"$ref": "#/components/schemas/SampleClass"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
"responses": {
|
|
279
|
+
"200": {
|
|
280
|
+
"description": "Status code 200",
|
|
281
|
+
"content": {
|
|
282
|
+
"application/json": {
|
|
283
|
+
"schema": {
|
|
284
|
+
"$ref": "#/components/schemas/SampleClass"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"304": {
|
|
290
|
+
"description": "Status code 304",
|
|
291
|
+
"content": {
|
|
292
|
+
"application/json": {
|
|
293
|
+
"schema": {
|
|
294
|
+
"$ref": "#/components/schemas/ChildClass"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"500": {
|
|
300
|
+
"description": "Status code 500",
|
|
301
|
+
"content": {
|
|
302
|
+
"application/json": {
|
|
303
|
+
"schema": {
|
|
304
|
+
"$ref": "#/components/schemas/SampleClass"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"components": {
|
|
314
|
+
"schemas": {
|
|
315
|
+
"SampleClass": {
|
|
316
|
+
"type": "object",
|
|
317
|
+
"properties": {
|
|
318
|
+
"MyProp": {
|
|
319
|
+
"type": "string"
|
|
320
|
+
},
|
|
321
|
+
"AnotherProp": {
|
|
322
|
+
"type": "number"
|
|
323
|
+
},
|
|
324
|
+
"someVariable": {
|
|
325
|
+
"type": "string"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"ChildClass": {
|
|
330
|
+
"type": "object",
|
|
331
|
+
"properties": {
|
|
332
|
+
"AProp": {
|
|
333
|
+
"type": "string"
|
|
334
|
+
},
|
|
335
|
+
"privateStringFromChild": {
|
|
336
|
+
"type": "string"
|
|
337
|
+
},
|
|
338
|
+
"protectedStringFromParent": {
|
|
339
|
+
"type": "string"
|
|
340
|
+
},
|
|
341
|
+
"publicStringFromParent": {
|
|
342
|
+
"type": "string"
|
|
343
|
+
},
|
|
344
|
+
"protectedGrandParentField": {
|
|
345
|
+
"type": "string"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
public class ChildClass extends ParentClass implements SampleInterface {
|
|
2
|
+
private String privateStringFromChild;
|
|
3
|
+
|
|
2
4
|
public void doSomething() {
|
|
3
5
|
System.debug('Do something');
|
|
4
6
|
}
|
|
@@ -21,4 +23,4 @@ public class ChildClass extends ParentClass implements SampleInterface {
|
|
|
21
23
|
* @return The value
|
|
22
24
|
*/
|
|
23
25
|
public String getValue();
|
|
24
|
-
}
|
|
26
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
public virtual class ParentClass extends GrandparentClass{
|
|
2
|
-
private String
|
|
2
|
+
private String privateStringFromParent;
|
|
3
3
|
/**
|
|
4
4
|
* @description This is a protected string, use carefully.
|
|
5
5
|
*/
|
|
6
|
-
protected String
|
|
7
|
-
public String
|
|
6
|
+
protected String protectedStringFromParent;
|
|
7
|
+
public String publicStringFromParent;
|
|
8
8
|
|
|
9
9
|
public virtual String overridableMethod() {
|
|
10
10
|
return '';
|
|
@@ -13,4 +13,4 @@ public virtual class ParentClass extends GrandparentClass{
|
|
|
13
13
|
public virtual String overridableMethodOverridden() {
|
|
14
14
|
return '';
|
|
15
15
|
}
|
|
16
|
-
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Account related operations.
|
|
3
|
+
*/
|
|
4
|
+
@RestResource(urlMapping='/Account/*')
|
|
5
|
+
global with sharing class SampleRestResource {
|
|
6
|
+
/**
|
|
7
|
+
* @description Sample HTTP Delete method with references to other types.
|
|
8
|
+
* @http-request-body
|
|
9
|
+
* description: This is an example of a request body
|
|
10
|
+
* required: true
|
|
11
|
+
* schema: SampleClass
|
|
12
|
+
* @http-parameter
|
|
13
|
+
* name: limit
|
|
14
|
+
* in: header
|
|
15
|
+
* required: true
|
|
16
|
+
* description: My sample description.
|
|
17
|
+
* schema: SampleClass
|
|
18
|
+
* @http-response
|
|
19
|
+
* statusCode: 200
|
|
20
|
+
* schema: SampleClass
|
|
21
|
+
* @http-response
|
|
22
|
+
* statusCode: 500
|
|
23
|
+
* schema: SampleClass
|
|
24
|
+
* @http-response
|
|
25
|
+
* statusCode: 304
|
|
26
|
+
* schema: ChildClass
|
|
27
|
+
*/
|
|
28
|
+
@HttpDelete
|
|
29
|
+
global static void doDelete() {
|
|
30
|
+
RestRequest req = RestContext.request;
|
|
31
|
+
RestResponse res = RestContext.response;
|
|
32
|
+
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
|
|
33
|
+
Account account = [SELECT Id FROM Account WHERE Id = :accountId];
|
|
34
|
+
delete account;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description This is a sample HTTP Get method
|
|
39
|
+
* @return An Account SObject.
|
|
40
|
+
* @http-parameter
|
|
41
|
+
* name: limit
|
|
42
|
+
* in: query
|
|
43
|
+
* required: true
|
|
44
|
+
* description: Limits the number of items on a page
|
|
45
|
+
* schema:
|
|
46
|
+
* type: integer
|
|
47
|
+
* @http-parameter
|
|
48
|
+
* name: complex
|
|
49
|
+
* in: cookie
|
|
50
|
+
* description: A more complex schema
|
|
51
|
+
* schema:
|
|
52
|
+
* type: array
|
|
53
|
+
* items:
|
|
54
|
+
* type: object
|
|
55
|
+
* properties:
|
|
56
|
+
* name:
|
|
57
|
+
* type: string
|
|
58
|
+
* @http-response
|
|
59
|
+
* statusCode: 200
|
|
60
|
+
* schema:
|
|
61
|
+
* type: object
|
|
62
|
+
* properties:
|
|
63
|
+
* id:
|
|
64
|
+
* type: string
|
|
65
|
+
* description: The super Id.
|
|
66
|
+
* name:
|
|
67
|
+
* type: string
|
|
68
|
+
* phone:
|
|
69
|
+
* type: string
|
|
70
|
+
* format: byte
|
|
71
|
+
* @http-response
|
|
72
|
+
* statusCode: 500
|
|
73
|
+
* schema:
|
|
74
|
+
* type: string
|
|
75
|
+
* @http-response
|
|
76
|
+
* statusCode: 304
|
|
77
|
+
* schema:
|
|
78
|
+
* type: object
|
|
79
|
+
* properties:
|
|
80
|
+
* error:
|
|
81
|
+
* type: string
|
|
82
|
+
* @http-response
|
|
83
|
+
* statusCode: 400
|
|
84
|
+
* schema:
|
|
85
|
+
* type: array
|
|
86
|
+
* items:
|
|
87
|
+
* type: object
|
|
88
|
+
* properties:
|
|
89
|
+
* name:
|
|
90
|
+
* type: string
|
|
91
|
+
* @http-response
|
|
92
|
+
* statusCode: 100
|
|
93
|
+
* schema:
|
|
94
|
+
* type: object
|
|
95
|
+
* properties:
|
|
96
|
+
* anotherObject:
|
|
97
|
+
* description: An object inside of an object
|
|
98
|
+
* type: object
|
|
99
|
+
* properties:
|
|
100
|
+
* message:
|
|
101
|
+
* type: string
|
|
102
|
+
* somethingElse:
|
|
103
|
+
* type: number
|
|
104
|
+
*/
|
|
105
|
+
@HttpGet
|
|
106
|
+
global static Account doGet() {
|
|
107
|
+
RestRequest req = RestContext.request;
|
|
108
|
+
RestResponse res = RestContext.response;
|
|
109
|
+
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
|
|
110
|
+
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId];
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @description This is a sample HTTP Post method
|
|
116
|
+
* @return A String SObject.
|
|
117
|
+
* @http-parameter
|
|
118
|
+
* name: limit
|
|
119
|
+
* in: query
|
|
120
|
+
* required: true
|
|
121
|
+
* description: Limits the number of items on a page
|
|
122
|
+
* schema:
|
|
123
|
+
* type: integer
|
|
124
|
+
* @http-parameter
|
|
125
|
+
* name: complex
|
|
126
|
+
* in: cookie
|
|
127
|
+
* description: A more complex schema
|
|
128
|
+
* schema:
|
|
129
|
+
* type: array
|
|
130
|
+
* items:
|
|
131
|
+
* type: object
|
|
132
|
+
* properties:
|
|
133
|
+
* name:
|
|
134
|
+
* type: string
|
|
135
|
+
* @http-request-body
|
|
136
|
+
* description: This is an example of a request body
|
|
137
|
+
* required: true
|
|
138
|
+
* schema:
|
|
139
|
+
* type: array
|
|
140
|
+
* items:
|
|
141
|
+
* type: object
|
|
142
|
+
* properties:
|
|
143
|
+
* name:
|
|
144
|
+
* type: string
|
|
145
|
+
* @http-response
|
|
146
|
+
* statusCode: 200
|
|
147
|
+
* schema:
|
|
148
|
+
* type: object
|
|
149
|
+
* properties:
|
|
150
|
+
* id:
|
|
151
|
+
* type: string
|
|
152
|
+
* description: The super Id.
|
|
153
|
+
* name:
|
|
154
|
+
* type: string
|
|
155
|
+
* phone:
|
|
156
|
+
* type: string
|
|
157
|
+
* format: byte
|
|
158
|
+
* @http-response
|
|
159
|
+
* statusCode: 500
|
|
160
|
+
* schema:
|
|
161
|
+
* type: string
|
|
162
|
+
* @http-response
|
|
163
|
+
* statusCode: 304
|
|
164
|
+
* schema:
|
|
165
|
+
* type: object
|
|
166
|
+
* properties:
|
|
167
|
+
* error:
|
|
168
|
+
* type: string
|
|
169
|
+
* @http-response
|
|
170
|
+
* statusCode: 400
|
|
171
|
+
* schema:
|
|
172
|
+
* type: array
|
|
173
|
+
* items:
|
|
174
|
+
* type: object
|
|
175
|
+
* properties:
|
|
176
|
+
* name:
|
|
177
|
+
* type: string
|
|
178
|
+
*/
|
|
179
|
+
@HttpPost
|
|
180
|
+
global static String doPost(String name,
|
|
181
|
+
String phone, String website) {
|
|
182
|
+
Account account = new Account();
|
|
183
|
+
account.Name = name;
|
|
184
|
+
account.phone = phone;
|
|
185
|
+
account.website = website;
|
|
186
|
+
insert account;
|
|
187
|
+
return account.Id;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -10,8 +10,9 @@ const parser_1 = require("../service/parser");
|
|
|
10
10
|
const settings_1 = require("../settings");
|
|
11
11
|
const transpiler_1 = require("../transpiler/transpiler");
|
|
12
12
|
const file_writer_1 = require("../service/file-writer");
|
|
13
|
-
const types_repository_1 = require("../model/types-repository");
|
|
14
13
|
const error_logger_1 = require("../util/error-logger");
|
|
14
|
+
const types_repository_1 = require("../model/types-repository");
|
|
15
|
+
const factory_1 = require("../transpiler/factory");
|
|
15
16
|
/**
|
|
16
17
|
* Application entry-point to generate documentation out of Apex source files.
|
|
17
18
|
*/
|
|
@@ -22,13 +23,11 @@ class Apexdocs {
|
|
|
22
23
|
static generate() {
|
|
23
24
|
logger_1.Logger.log('Initializing...');
|
|
24
25
|
const fileBodies = apex_file_reader_1.ApexFileReader.processFiles(new file_system_1.DefaultFileSystem());
|
|
25
|
-
const manifest = manifest_factory_1.createManifest(new parser_1.RawBodyParser(fileBodies), this._reflectionWithLogger);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
logger_1.Logger.logSingle(`Creating documentation for ${filteredTypes.length} file(s)`, false, 'green', false);
|
|
31
|
-
const processor = settings_1.Settings.getInstance().typeTranspiler;
|
|
26
|
+
const manifest = (0, manifest_factory_1.createManifest)(new parser_1.RawBodyParser(fileBodies), this._reflectionWithLogger);
|
|
27
|
+
types_repository_1.TypesRepository.getInstance().populateAll(manifest.types);
|
|
28
|
+
const filteredTypes = this.filterByScopes(manifest);
|
|
29
|
+
types_repository_1.TypesRepository.getInstance().populateScoped(filteredTypes);
|
|
30
|
+
const processor = factory_1.TypeTranspilerFactory.get(settings_1.Settings.getInstance().targetGenerator);
|
|
32
31
|
transpiler_1.default.generate(filteredTypes, processor);
|
|
33
32
|
const generatedFiles = processor.fileBuilder().files();
|
|
34
33
|
file_writer_1.FileWriter.write(generatedFiles, (fileName) => {
|
|
@@ -37,11 +36,36 @@ class Apexdocs {
|
|
|
37
36
|
// Error logging
|
|
38
37
|
error_logger_1.default.logErrors(filteredTypes);
|
|
39
38
|
}
|
|
39
|
+
static filterByScopes(manifest) {
|
|
40
|
+
let filteredTypes;
|
|
41
|
+
let filteredLogMessage;
|
|
42
|
+
if (settings_1.Settings.getInstance().config.targetGenerator !== 'openapi') {
|
|
43
|
+
filteredTypes = manifest.filteredByAccessModifierAndAnnotations(settings_1.Settings.getInstance().scope);
|
|
44
|
+
filteredLogMessage = `Filtered ${manifest.types.length - filteredTypes.length} file(s) based on scope: ${settings_1.Settings.getInstance().scope}`;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// If we are dealing with an OpenApi generator, we ignore the passed in access modifiers, and instead
|
|
48
|
+
// we only keep classes annotated as @RestResource
|
|
49
|
+
filteredTypes = manifest.filteredByAccessModifierAndAnnotations([
|
|
50
|
+
'restresource',
|
|
51
|
+
'httpdelete',
|
|
52
|
+
'httpget',
|
|
53
|
+
'httppatch',
|
|
54
|
+
'httppost',
|
|
55
|
+
'httpput',
|
|
56
|
+
]);
|
|
57
|
+
filteredLogMessage = `Filtered ${manifest.types.length - filteredTypes.length} file(s), only keeping classes annotated as @RestResource.`;
|
|
58
|
+
}
|
|
59
|
+
logger_1.Logger.clear();
|
|
60
|
+
logger_1.Logger.logSingle(filteredLogMessage, false, 'green', false);
|
|
61
|
+
logger_1.Logger.logSingle(`Creating documentation for ${filteredTypes.length} file(s)`, false, 'green', false);
|
|
62
|
+
return filteredTypes;
|
|
63
|
+
}
|
|
40
64
|
}
|
|
41
65
|
exports.Apexdocs = Apexdocs;
|
|
42
66
|
Apexdocs._reflectionWithLogger = (apexBundle) => {
|
|
43
67
|
var _a;
|
|
44
|
-
const result = apex_reflection_1.reflect(apexBundle.rawTypeContent);
|
|
68
|
+
const result = (0, apex_reflection_1.reflect)(apexBundle.rawTypeContent);
|
|
45
69
|
if (result.error) {
|
|
46
70
|
logger_1.Logger.error(`${apexBundle.filePath} - Parsing error ${(_a = result.error) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
47
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Apexdocs.js","sourceRoot":"","sources":["../../src/application/Apexdocs.ts"],"names":[],"mappings":";;;AAAA,kEAA6D;AAC7D,wDAA2D;AAC3D,6DAA0E;AAC1E,2CAAwC;AACxC,kEAA6D;AAC7D,8CAAkD;AAClD,0CAAuC;AACvC,yDAAkD;AAClD,wDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"Apexdocs.js","sourceRoot":"","sources":["../../src/application/Apexdocs.ts"],"names":[],"mappings":";;;AAAA,kEAA6D;AAC7D,wDAA2D;AAC3D,6DAA0E;AAC1E,2C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