@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,474 @@
|
|
|
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
|
+
"305": {
|
|
300
|
+
"description": "Status code 305",
|
|
301
|
+
"content": {
|
|
302
|
+
"application/json": {
|
|
303
|
+
"schema": {
|
|
304
|
+
"$ref": "#/components/schemas/Reference1"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"306": {
|
|
310
|
+
"description": "Status code 306",
|
|
311
|
+
"content": {
|
|
312
|
+
"application/json": {
|
|
313
|
+
"schema": {
|
|
314
|
+
"$ref": "#/components/schemas/Reference1_array"
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"500": {
|
|
320
|
+
"description": "Status code 500",
|
|
321
|
+
"content": {
|
|
322
|
+
"application/json": {
|
|
323
|
+
"schema": {
|
|
324
|
+
"$ref": "#/components/schemas/SampleClass"
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
"/Contact/*": {
|
|
333
|
+
"description": "Contact related operations",
|
|
334
|
+
"get": {
|
|
335
|
+
"description": "This is a sample HTTP Get method",
|
|
336
|
+
"responses": {
|
|
337
|
+
"200": {
|
|
338
|
+
"description": "Status code 200",
|
|
339
|
+
"content": {
|
|
340
|
+
"application/json": {
|
|
341
|
+
"schema": {
|
|
342
|
+
"$ref": "#/components/schemas/SampleRestResourceWithInnerClass.InnerClass"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"components": {
|
|
352
|
+
"schemas": {
|
|
353
|
+
"SampleClass": {
|
|
354
|
+
"type": "object",
|
|
355
|
+
"properties": {
|
|
356
|
+
"MyProp": {
|
|
357
|
+
"type": "string",
|
|
358
|
+
"description": "This is a String property."
|
|
359
|
+
},
|
|
360
|
+
"AnotherProp": {
|
|
361
|
+
"type": "number",
|
|
362
|
+
"description": "This is a Decimal property."
|
|
363
|
+
},
|
|
364
|
+
"listOfStrings": {
|
|
365
|
+
"type": "array",
|
|
366
|
+
"items": {
|
|
367
|
+
"type": "string"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
"someVariable": {
|
|
371
|
+
"type": "string"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"ChildClass": {
|
|
376
|
+
"type": "object",
|
|
377
|
+
"properties": {
|
|
378
|
+
"AProp": {
|
|
379
|
+
"type": "string"
|
|
380
|
+
},
|
|
381
|
+
"privateStringFromChild": {
|
|
382
|
+
"type": "string"
|
|
383
|
+
},
|
|
384
|
+
"protectedStringFromParent": {
|
|
385
|
+
"type": "string",
|
|
386
|
+
"description": "This is a protected string, use carefully."
|
|
387
|
+
},
|
|
388
|
+
"publicStringFromParent": {
|
|
389
|
+
"type": "string"
|
|
390
|
+
},
|
|
391
|
+
"protectedGrandParentField": {
|
|
392
|
+
"type": "string"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
"Reference1": {
|
|
397
|
+
"type": "object",
|
|
398
|
+
"properties": {
|
|
399
|
+
"reference2Member": {
|
|
400
|
+
"$ref": "#/components/schemas/Reference2",
|
|
401
|
+
"description": "This is a reference 2 member. Lorem."
|
|
402
|
+
},
|
|
403
|
+
"reference3Member": {
|
|
404
|
+
"$ref": "#/components/schemas/Reference3"
|
|
405
|
+
},
|
|
406
|
+
"reference4Collection": {
|
|
407
|
+
"type": "array",
|
|
408
|
+
"items": {
|
|
409
|
+
"$ref": "#/components/schemas/Reference4"
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"reference5Member": {
|
|
413
|
+
"$ref": "#/components/schemas/Reference5"
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
"Reference2": {
|
|
418
|
+
"type": "object",
|
|
419
|
+
"properties": {
|
|
420
|
+
"stringMember": {
|
|
421
|
+
"type": "string"
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
"Reference3": {
|
|
426
|
+
"type": "object",
|
|
427
|
+
"properties": {
|
|
428
|
+
"someBoolean": {
|
|
429
|
+
"type": "boolean"
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"Reference4": {
|
|
434
|
+
"type": "object",
|
|
435
|
+
"properties": {
|
|
436
|
+
"someString": {
|
|
437
|
+
"type": "string"
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
"Reference5": {
|
|
442
|
+
"type": "object",
|
|
443
|
+
"properties": {
|
|
444
|
+
"reference6Member": {
|
|
445
|
+
"$ref": "#/components/schemas/Reference6"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
"Reference6": {
|
|
450
|
+
"type": "object",
|
|
451
|
+
"properties": {
|
|
452
|
+
"grandChildString": {
|
|
453
|
+
"type": "string",
|
|
454
|
+
"description": "This is the grandchild description."
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
"Reference1_array": {
|
|
459
|
+
"type": "array",
|
|
460
|
+
"items": {
|
|
461
|
+
"$ref": "#/components/schemas/Reference1"
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
"SampleRestResourceWithInnerClass.InnerClass": {
|
|
465
|
+
"type": "object",
|
|
466
|
+
"properties": {
|
|
467
|
+
"stringMember": {
|
|
468
|
+
"type": "string"
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
@@ -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,195 @@
|
|
|
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
|
+
* @http-response
|
|
28
|
+
* statusCode: 305
|
|
29
|
+
* schema: Reference1
|
|
30
|
+
* @http-response
|
|
31
|
+
* statusCode: 306
|
|
32
|
+
* schema: List<Reference1>
|
|
33
|
+
*/
|
|
34
|
+
@HttpDelete
|
|
35
|
+
global static void doDelete() {
|
|
36
|
+
RestRequest req = RestContext.request;
|
|
37
|
+
RestResponse res = RestContext.response;
|
|
38
|
+
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
|
|
39
|
+
Account account = [SELECT Id FROM Account WHERE Id = :accountId];
|
|
40
|
+
delete account;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @description This is a sample HTTP Get method
|
|
45
|
+
* @return An Account SObject.
|
|
46
|
+
* @http-parameter
|
|
47
|
+
* name: limit
|
|
48
|
+
* in: query
|
|
49
|
+
* required: true
|
|
50
|
+
* description: Limits the number of items on a page
|
|
51
|
+
* schema:
|
|
52
|
+
* type: integer
|
|
53
|
+
* @http-parameter
|
|
54
|
+
* name: complex
|
|
55
|
+
* in: cookie
|
|
56
|
+
* description: A more complex schema
|
|
57
|
+
* schema:
|
|
58
|
+
* type: array
|
|
59
|
+
* items:
|
|
60
|
+
* type: object
|
|
61
|
+
* properties:
|
|
62
|
+
* name:
|
|
63
|
+
* type: string
|
|
64
|
+
* @http-response
|
|
65
|
+
* statusCode: 200
|
|
66
|
+
* schema:
|
|
67
|
+
* type: object
|
|
68
|
+
* properties:
|
|
69
|
+
* id:
|
|
70
|
+
* type: string
|
|
71
|
+
* description: The super Id.
|
|
72
|
+
* name:
|
|
73
|
+
* type: string
|
|
74
|
+
* phone:
|
|
75
|
+
* type: string
|
|
76
|
+
* format: byte
|
|
77
|
+
* @http-response
|
|
78
|
+
* statusCode: 500
|
|
79
|
+
* schema:
|
|
80
|
+
* type: string
|
|
81
|
+
* @http-response
|
|
82
|
+
* statusCode: 304
|
|
83
|
+
* schema:
|
|
84
|
+
* type: object
|
|
85
|
+
* properties:
|
|
86
|
+
* error:
|
|
87
|
+
* type: string
|
|
88
|
+
* @http-response
|
|
89
|
+
* statusCode: 400
|
|
90
|
+
* schema:
|
|
91
|
+
* type: array
|
|
92
|
+
* items:
|
|
93
|
+
* type: object
|
|
94
|
+
* properties:
|
|
95
|
+
* name:
|
|
96
|
+
* type: string
|
|
97
|
+
* @http-response
|
|
98
|
+
* statusCode: 100
|
|
99
|
+
* schema:
|
|
100
|
+
* type: object
|
|
101
|
+
* properties:
|
|
102
|
+
* anotherObject:
|
|
103
|
+
* description: An object inside of an object
|
|
104
|
+
* type: object
|
|
105
|
+
* properties:
|
|
106
|
+
* message:
|
|
107
|
+
* type: string
|
|
108
|
+
* somethingElse:
|
|
109
|
+
* type: number
|
|
110
|
+
*/
|
|
111
|
+
@HttpGet
|
|
112
|
+
global static Account doGet() {
|
|
113
|
+
RestRequest req = RestContext.request;
|
|
114
|
+
RestResponse res = RestContext.response;
|
|
115
|
+
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
|
|
116
|
+
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId];
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @description This is a sample HTTP Post method
|
|
122
|
+
* @return A String SObject.
|
|
123
|
+
* @http-parameter
|
|
124
|
+
* name: limit
|
|
125
|
+
* in: query
|
|
126
|
+
* required: true
|
|
127
|
+
* description: Limits the number of items on a page
|
|
128
|
+
* schema:
|
|
129
|
+
* type: integer
|
|
130
|
+
* @http-parameter
|
|
131
|
+
* name: complex
|
|
132
|
+
* in: cookie
|
|
133
|
+
* description: A more complex schema
|
|
134
|
+
* schema:
|
|
135
|
+
* type: array
|
|
136
|
+
* items:
|
|
137
|
+
* type: object
|
|
138
|
+
* properties:
|
|
139
|
+
* name:
|
|
140
|
+
* type: string
|
|
141
|
+
* @http-request-body
|
|
142
|
+
* description: This is an example of a request body
|
|
143
|
+
* required: true
|
|
144
|
+
* schema:
|
|
145
|
+
* type: array
|
|
146
|
+
* items:
|
|
147
|
+
* type: object
|
|
148
|
+
* properties:
|
|
149
|
+
* name:
|
|
150
|
+
* type: string
|
|
151
|
+
* @http-response
|
|
152
|
+
* statusCode: 200
|
|
153
|
+
* schema:
|
|
154
|
+
* type: object
|
|
155
|
+
* properties:
|
|
156
|
+
* id:
|
|
157
|
+
* type: string
|
|
158
|
+
* description: The super Id.
|
|
159
|
+
* name:
|
|
160
|
+
* type: string
|
|
161
|
+
* phone:
|
|
162
|
+
* type: string
|
|
163
|
+
* format: byte
|
|
164
|
+
* @http-response
|
|
165
|
+
* statusCode: 500
|
|
166
|
+
* schema:
|
|
167
|
+
* type: string
|
|
168
|
+
* @http-response
|
|
169
|
+
* statusCode: 304
|
|
170
|
+
* schema:
|
|
171
|
+
* type: object
|
|
172
|
+
* properties:
|
|
173
|
+
* error:
|
|
174
|
+
* type: string
|
|
175
|
+
* @http-response
|
|
176
|
+
* statusCode: 400
|
|
177
|
+
* schema:
|
|
178
|
+
* type: array
|
|
179
|
+
* items:
|
|
180
|
+
* type: object
|
|
181
|
+
* properties:
|
|
182
|
+
* name:
|
|
183
|
+
* type: string
|
|
184
|
+
*/
|
|
185
|
+
@HttpPost
|
|
186
|
+
global static String doPost(String name,
|
|
187
|
+
String phone, String website) {
|
|
188
|
+
Account account = new Account();
|
|
189
|
+
account.Name = name;
|
|
190
|
+
account.phone = phone;
|
|
191
|
+
account.website = website;
|
|
192
|
+
insert account;
|
|
193
|
+
return account.Id;
|
|
194
|
+
}
|
|
195
|
+
}
|