@cparra/apexdocs 3.0.0-alpha.9 → 3.0.0-beta.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.
Files changed (51) hide show
  1. package/dist/cli/generate.js +294 -204
  2. package/examples/open-api/config/project-scratch-def.json +13 -0
  3. package/examples/open-api/docs/openapi.json +582 -0
  4. package/examples/{force-app → open-api/force-app}/main/default/classes/SampleClass.cls +1 -0
  5. package/examples/open-api/package-lock.json +724 -0
  6. package/examples/open-api/package.json +20 -0
  7. package/examples/open-api/sfdx-project.json +12 -0
  8. package/package.json +1 -1
  9. package/src/application/Apexdocs.ts +39 -7
  10. package/src/application/__tests__/apex-file-reader.spec.ts +0 -17
  11. package/src/application/file-writer.ts +37 -15
  12. package/src/application/generators/markdown.ts +10 -39
  13. package/src/application/generators/openapi.ts +22 -6
  14. package/src/cli/args.ts +4 -1
  15. package/src/cli/commands/openapi.ts +36 -0
  16. package/src/core/markdown/adapters/documentables.ts +0 -1
  17. package/src/core/markdown/generate-docs.ts +2 -5
  18. package/src/core/markdown/reflection/reflect-source.ts +51 -50
  19. package/src/core/openApiSettings.ts +41 -0
  20. package/src/core/openapi/__tests__/open-api-docs-processor.spec.ts +2 -2
  21. package/src/core/openapi/open-api-docs-processor.ts +8 -4
  22. package/src/core/openapi/open-api.ts +5 -1
  23. package/src/core/openapi/openapi-type-file.ts +1 -1
  24. package/src/core/openapi/parser.ts +1 -15
  25. package/src/core/openapi/transpiler.ts +0 -5
  26. package/src/core/parse-apex-metadata.ts +21 -5
  27. package/src/core/shared/types.d.ts +4 -1
  28. package/src/test-helpers/SettingsBuilder.ts +2 -6
  29. package/examples/force-app/main/default/classes/AnotherInterface.cls +0 -16
  30. package/examples/force-app/main/default/classes/EscapedAnnotations.cls +0 -5
  31. package/examples/force-app/main/default/classes/GrandparentClass.cls +0 -5
  32. package/examples/force-app/main/default/classes/GroupedClass.cls +0 -8
  33. package/examples/force-app/main/default/classes/InterfaceWithInheritance.cls +0 -1
  34. package/examples/force-app/main/default/classes/MemberGrouping.cls +0 -17
  35. package/examples/force-app/main/default/classes/ParentClass.cls +0 -16
  36. package/examples/force-app/main/default/classes/SampleClass.cls-meta.xml +0 -5
  37. package/examples/force-app/main/default/classes/SampleClassWithoutModifier.cls +0 -9
  38. package/examples/force-app/main/default/classes/SampleInterface.cls +0 -16
  39. package/src/core/settings.ts +0 -56
  40. /package/examples/{force-app → open-api/force-app}/main/default/classes/ChildClass.cls +0 -0
  41. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResource.cls +0 -0
  42. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResourceToSkip.cls +0 -0
  43. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResourceWithInnerClass.cls +0 -0
  44. /package/examples/{force-app → open-api/force-app}/main/default/restapi/SampleRestResourceWithoutApexDocs.cls +0 -0
  45. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference1.cls +0 -0
  46. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference2.cls +0 -0
  47. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference3.cls +0 -0
  48. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference4.cls +0 -0
  49. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference5.cls +0 -0
  50. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference6.cls +0 -0
  51. /package/examples/{force-app → open-api/force-app}/main/default/restapi/references/Reference7.cls +0 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "orgName": "openapi example",
3
+ "edition": "Developer",
4
+ "features": ["EnableSetPasswordInApi"],
5
+ "settings": {
6
+ "lightningExperienceSettings": {
7
+ "enableS1DesktopEnabled": true
8
+ },
9
+ "mobileSettings": {
10
+ "enableS1EncryptedStoragePref2": false
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,582 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Open API Example",
5
+ "version": "3.0.0"
6
+ },
7
+ "servers": [
8
+ {
9
+ "url": "/services/apexrest/openapi/"
10
+ }
11
+ ],
12
+ "paths": {
13
+ "AccountService/": {
14
+ "description": "Account related operations",
15
+ "get": {
16
+ "tags": [
17
+ "Account Service"
18
+ ],
19
+ "description": "This is a sample HTTP Get method",
20
+ "parameters": [
21
+ {
22
+ "name": "limit",
23
+ "in": "query",
24
+ "required": true,
25
+ "description": "Limits the number of items on a page",
26
+ "schema": {
27
+ "type": "integer"
28
+ }
29
+ },
30
+ {
31
+ "name": "complex",
32
+ "in": "cookie",
33
+ "description": "A more complex schema",
34
+ "schema": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "object",
38
+ "properties": {
39
+ "name": {
40
+ "type": "string"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ],
47
+ "responses": {
48
+ "100": {
49
+ "description": "Status code 100",
50
+ "content": {
51
+ "application/json": {
52
+ "schema": {
53
+ "type": "object",
54
+ "properties": {
55
+ "anotherObject": {
56
+ "description": "An object inside of an object",
57
+ "type": "object",
58
+ "properties": {
59
+ "message": {
60
+ "type": "string"
61
+ },
62
+ "somethingElse": {
63
+ "type": "number"
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "200": {
73
+ "description": "Status code 200",
74
+ "content": {
75
+ "application/json": {
76
+ "schema": {
77
+ "type": "object",
78
+ "properties": {
79
+ "id": {
80
+ "type": "string",
81
+ "description": "The super Id."
82
+ },
83
+ "name": {
84
+ "type": "string"
85
+ },
86
+ "phone": {
87
+ "type": "string",
88
+ "format": "byte"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ },
95
+ "304": {
96
+ "description": "Status code 304",
97
+ "content": {
98
+ "application/json": {
99
+ "schema": {
100
+ "type": "object",
101
+ "properties": {
102
+ "error": {
103
+ "type": "string"
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "400": {
111
+ "description": "Status code 400",
112
+ "content": {
113
+ "application/json": {
114
+ "schema": {
115
+ "type": "array",
116
+ "items": {
117
+ "type": "object",
118
+ "properties": {
119
+ "name": {
120
+ "type": "string"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ },
128
+ "500": {
129
+ "description": "Status code 500",
130
+ "content": {
131
+ "application/json": {
132
+ "schema": {
133
+ "type": "string"
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+ },
140
+ "post": {
141
+ "tags": [
142
+ "Account Service"
143
+ ],
144
+ "description": "This is a sample HTTP Post method",
145
+ "summary": "Posts an Account 2",
146
+ "requestBody": {
147
+ "description": "This is an example of a request body",
148
+ "content": {
149
+ "application/json": {
150
+ "schema": {
151
+ "type": "array",
152
+ "items": {
153
+ "type": "object",
154
+ "properties": {
155
+ "name": {
156
+ "type": "string"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ }
162
+ },
163
+ "required": true
164
+ },
165
+ "parameters": [
166
+ {
167
+ "name": "limit",
168
+ "in": "query",
169
+ "required": true,
170
+ "description": "Limits the number of items on a page",
171
+ "schema": {
172
+ "type": "integer"
173
+ }
174
+ },
175
+ {
176
+ "name": "complex",
177
+ "in": "cookie",
178
+ "description": "A more complex schema",
179
+ "schema": {
180
+ "type": "array",
181
+ "items": {
182
+ "type": "object",
183
+ "properties": {
184
+ "name": {
185
+ "type": "string"
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+ ],
192
+ "responses": {
193
+ "200": {
194
+ "description": "Status code 200",
195
+ "content": {
196
+ "application/json": {
197
+ "schema": {
198
+ "type": "object",
199
+ "properties": {
200
+ "id": {
201
+ "type": "string",
202
+ "description": "The super Id."
203
+ },
204
+ "name": {
205
+ "type": "string"
206
+ },
207
+ "phone": {
208
+ "type": "string",
209
+ "format": "byte"
210
+ }
211
+ }
212
+ }
213
+ }
214
+ }
215
+ },
216
+ "304": {
217
+ "description": "Status code 304",
218
+ "content": {
219
+ "application/json": {
220
+ "schema": {
221
+ "type": "object",
222
+ "properties": {
223
+ "error": {
224
+ "type": "string"
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ },
231
+ "400": {
232
+ "description": "Status code 400",
233
+ "content": {
234
+ "application/json": {
235
+ "schema": {
236
+ "type": "array",
237
+ "items": {
238
+ "type": "object",
239
+ "properties": {
240
+ "name": {
241
+ "type": "string"
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ },
249
+ "500": {
250
+ "description": "Status code 500",
251
+ "content": {
252
+ "application/json": {
253
+ "schema": {
254
+ "type": "string"
255
+ }
256
+ }
257
+ }
258
+ }
259
+ }
260
+ },
261
+ "delete": {
262
+ "tags": [
263
+ "Account Service"
264
+ ],
265
+ "description": "Sample HTTP Delete method with references to other types.",
266
+ "parameters": [
267
+ {
268
+ "name": "limit",
269
+ "in": "header",
270
+ "required": true,
271
+ "description": "My sample description.",
272
+ "schema": {
273
+ "$ref": "#/components/schemas/SampleClass"
274
+ }
275
+ }
276
+ ],
277
+ "responses": {
278
+ "200": {
279
+ "description": "Status code 200",
280
+ "content": {
281
+ "application/json": {
282
+ "schema": {
283
+ "$ref": "#/components/schemas/SampleClass"
284
+ }
285
+ }
286
+ }
287
+ },
288
+ "304": {
289
+ "description": "Status code 304",
290
+ "content": {
291
+ "application/json": {
292
+ "schema": {
293
+ "$ref": "#/components/schemas/ChildClass"
294
+ }
295
+ }
296
+ }
297
+ },
298
+ "305": {
299
+ "description": "Status code 305",
300
+ "content": {
301
+ "application/json": {
302
+ "schema": {
303
+ "$ref": "#/components/schemas/Reference1"
304
+ }
305
+ }
306
+ }
307
+ },
308
+ "306": {
309
+ "description": "Status code 306",
310
+ "content": {
311
+ "application/json": {
312
+ "schema": {
313
+ "$ref": "#/components/schemas/Reference1_array"
314
+ }
315
+ }
316
+ }
317
+ },
318
+ "307": {
319
+ "description": "Status code 307",
320
+ "content": {
321
+ "application/json": {
322
+ "schema": {
323
+ "$ref": "#/components/schemas/Reference7_Reference7[untypedObject:Reference2]"
324
+ }
325
+ }
326
+ }
327
+ },
328
+ "500": {
329
+ "description": "Status code 500",
330
+ "content": {
331
+ "application/json": {
332
+ "schema": {
333
+ "$ref": "#/components/schemas/SampleClass"
334
+ }
335
+ }
336
+ }
337
+ }
338
+ }
339
+ }
340
+ },
341
+ "Contact/": {
342
+ "description": "Contact related operations",
343
+ "get": {
344
+ "tags": [
345
+ "Contact"
346
+ ],
347
+ "description": "This is a sample HTTP Get method",
348
+ "responses": {
349
+ "200": {
350
+ "description": "Status code 200",
351
+ "content": {
352
+ "application/json": {
353
+ "schema": {
354
+ "$ref": "#/components/schemas/SampleRestResourceWithInnerClass.InnerClass"
355
+ }
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+ },
362
+ "Order/": {
363
+ "description": "Order related operations",
364
+ "get": {
365
+ "tags": [
366
+ "Order"
367
+ ],
368
+ "requestBody": {
369
+ "content": {
370
+ "application/json": {
371
+ "schema": {
372
+ "type": "object",
373
+ "properties": {
374
+ "param1": {
375
+ "type": "string"
376
+ },
377
+ "param2": {
378
+ "$ref": "#/components/schemas/Reference1"
379
+ }
380
+ }
381
+ }
382
+ }
383
+ }
384
+ },
385
+ "responses": {
386
+ "200": {
387
+ "description": "Status code 200",
388
+ "content": {
389
+ "application/json": {
390
+ "schema": {
391
+ "type": "string"
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ },
398
+ "patch": {
399
+ "tags": [
400
+ "Order"
401
+ ],
402
+ "requestBody": {
403
+ "content": {
404
+ "application/json": {
405
+ "schema": {
406
+ "type": "object",
407
+ "properties": {
408
+ "param1": {
409
+ "type": "string"
410
+ },
411
+ "param2": {
412
+ "$ref": "#/components/schemas/Reference1"
413
+ }
414
+ }
415
+ }
416
+ }
417
+ }
418
+ },
419
+ "responses": {
420
+ "200": {
421
+ "description": "Status code 200",
422
+ "content": {
423
+ "application/json": {
424
+ "schema": {
425
+ "type": "string"
426
+ }
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+ }
433
+ },
434
+ "tags": [
435
+ {
436
+ "name": "Account Service",
437
+ "description": "Account related operations"
438
+ },
439
+ {
440
+ "name": "Contact",
441
+ "description": "Contact related operations"
442
+ },
443
+ {
444
+ "name": "Order",
445
+ "description": "Order related operations"
446
+ }
447
+ ],
448
+ "components": {
449
+ "schemas": {
450
+ "SampleClass": {
451
+ "type": "object",
452
+ "properties": {
453
+ "MyProp": {
454
+ "type": "string",
455
+ "description": "This is a String property."
456
+ },
457
+ "AnotherProp": {
458
+ "type": "number",
459
+ "description": "This is a Decimal property."
460
+ },
461
+ "listOfStrings": {
462
+ "type": "array",
463
+ "items": {
464
+ "type": "string"
465
+ }
466
+ },
467
+ "someVariable": {
468
+ "type": "string"
469
+ },
470
+ "somePrivateStuff": {
471
+ "type": "string"
472
+ }
473
+ }
474
+ },
475
+ "ChildClass": {
476
+ "type": "object",
477
+ "properties": {
478
+ "privateStringFromChild": {
479
+ "type": "string"
480
+ },
481
+ "aPrivateString": {
482
+ "type": "string"
483
+ }
484
+ }
485
+ },
486
+ "Reference1": {
487
+ "type": "object",
488
+ "properties": {
489
+ "reference2Member": {
490
+ "$ref": "#/components/schemas/Reference2",
491
+ "description": "This is a reference 2 member. Lorem."
492
+ },
493
+ "reference3Member": {
494
+ "$ref": "#/components/schemas/Reference3"
495
+ },
496
+ "reference4Collection": {
497
+ "type": "array",
498
+ "items": {
499
+ "$ref": "#/components/schemas/Reference4"
500
+ }
501
+ },
502
+ "reference5Member": {
503
+ "$ref": "#/components/schemas/Reference5"
504
+ }
505
+ }
506
+ },
507
+ "Reference2": {
508
+ "type": "object",
509
+ "properties": {
510
+ "stringMember": {
511
+ "type": "string"
512
+ },
513
+ "objectReference": {
514
+ "$ref": "#/components/schemas/Reference3_array",
515
+ "description": "This is an object reference."
516
+ }
517
+ }
518
+ },
519
+ "Reference3_array": {
520
+ "type": "array",
521
+ "items": {
522
+ "$ref": "#/components/schemas/Reference3"
523
+ }
524
+ },
525
+ "Reference3": {
526
+ "type": "object",
527
+ "properties": {
528
+ "someBoolean": {
529
+ "type": "boolean"
530
+ }
531
+ }
532
+ },
533
+ "Reference4": {
534
+ "type": "object",
535
+ "properties": {
536
+ "someString": {
537
+ "type": "string"
538
+ }
539
+ }
540
+ },
541
+ "Reference5": {
542
+ "type": "object",
543
+ "properties": {
544
+ "reference6Member": {
545
+ "$ref": "#/components/schemas/Reference6"
546
+ }
547
+ }
548
+ },
549
+ "Reference6": {
550
+ "type": "object",
551
+ "properties": {
552
+ "grandChildString": {
553
+ "type": "string",
554
+ "description": "This is the grandchild description."
555
+ }
556
+ }
557
+ },
558
+ "Reference1_array": {
559
+ "type": "array",
560
+ "items": {
561
+ "$ref": "#/components/schemas/Reference1"
562
+ }
563
+ },
564
+ "Reference7_Reference7[untypedObject:Reference2]": {
565
+ "type": "object",
566
+ "properties": {
567
+ "untypedObject": {
568
+ "$ref": "#/components/schemas/Reference2"
569
+ }
570
+ }
571
+ },
572
+ "SampleRestResourceWithInnerClass.InnerClass": {
573
+ "type": "object",
574
+ "properties": {
575
+ "stringMember": {
576
+ "type": "string"
577
+ }
578
+ }
579
+ }
580
+ }
581
+ }
582
+ }
@@ -1,3 +1,4 @@
1
+
1
2
  /**
2
3
  * @description This is a class description. This class relates to {@link SampleInterface}
3
4
  * But this {@link ClassThatDoesNotExist} does not exist.