@e22m4u/js-openapi 0.0.5 → 0.0.6
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/README.md +226 -146
- package/dist/cjs/index.cjs +2024 -2092
- package/package.json +10 -8
- package/schema/openapi-3-1/dialect/base.js +21 -0
- package/schema/openapi-3-1/meta/base.js +76 -0
- package/schema/openapi-3-1/schema-base.js +32 -0
- package/schema/openapi-3-1/schema.js +1403 -0
- package/src/ajv.js +32 -0
- package/src/errors/index.d.ts +1 -1
- package/src/errors/index.js +1 -1
- package/src/errors/oa-document-object-validation-error.d.ts +6 -0
- package/src/errors/oa-document-object-validation-error.js +6 -0
- package/src/errors/oa-document-object-validation-error.spec.js +10 -0
- package/src/index.d.ts +1 -3
- package/src/index.js +1 -3
- package/src/json-pointer/resolve-json-pointer.js +1 -1
- package/src/json-pointer/unescape-json-pointer.d.ts +1 -2
- package/src/oa-document-builder.d.ts +302 -111
- package/src/oa-document-builder.js +208 -142
- package/src/oa-document-builder.spec.js +1408 -0
- package/src/oa-document-object/index.d.ts +1 -1
- package/src/oa-document-object/index.js +1 -1
- package/src/oa-document-object/validate-oa-document-object.d.ts +18 -0
- package/src/oa-document-object/validate-oa-document-object.js +53 -0
- package/src/oa-document-object/validate-oa-document-object.spec.js +122 -0
- package/src/{oa-document-scope.d.ts → oa-operation-group.d.ts} +7 -7
- package/src/{oa-document-scope.js → oa-operation-group.js} +101 -46
- package/src/oa-operation-group.spec.js +544 -0
- package/src/oa-reference-object/is-oa-reference-object.js +1 -1
- package/src/oa-reference-object/is-oa-reference-object.spec.js +1 -1
- package/src/oa-reference-object/oa-ref.js +7 -0
- package/src/oa-reference-object/resolve-oa-reference-object.js +1 -11
- package/src/oa-reference-object/resolve-oa-reference-object.spec.js +0 -10
- package/src/oa-specification.d.ts +54 -66
- package/src/oa-specification.js +10 -22
- package/src/data-type/index.d.ts +0 -1
- package/src/data-type/index.js +0 -1
- package/src/data-type/infer-openapi-data-type.d.ts +0 -30
- package/src/data-type/infer-openapi-data-type.js +0 -38
- package/src/data-validation/data-format-validator-map.d.ts +0 -13
- package/src/data-validation/data-format-validator-map.js +0 -36
- package/src/data-validation/data-format-validator-map.spec.js +0 -39
- package/src/data-validation/data-format-validators.d.ts +0 -84
- package/src/data-validation/data-format-validators.js +0 -217
- package/src/data-validation/index.d.ts +0 -3
- package/src/data-validation/index.js +0 -3
- package/src/data-validation/validate-data-with-openapi-schema.d.ts +0 -46
- package/src/data-validation/validate-data-with-openapi-schema.js +0 -1913
- package/src/data-validation/validate-data-with-openapi-schema.spec.js +0 -6953
- package/src/errors/oa-data-validation-error.d.ts +0 -6
- package/src/errors/oa-data-validation-error.js +0 -6
- package/src/errors/oa-data-validation-error.spec.js +0 -17
- package/src/oa-document-object/validate-shallow-oa-document.d.ts +0 -10
- package/src/oa-document-object/validate-shallow-oa-document.js +0 -209
- package/src/oa-document-object/validate-shallow-oa-document.spec.js +0 -362
- package/src/utils/count-unicode.d.ts +0 -11
- package/src/utils/count-unicode.js +0 -15
- package/src/utils/index.d.ts +0 -5
- package/src/utils/index.js +0 -5
- package/src/utils/join-path.d.ts +0 -6
- package/src/utils/join-path.js +0 -36
- package/src/utils/join-path.spec.js +0 -104
- package/src/utils/normalize-path.d.ts +0 -12
- package/src/utils/normalize-path.js +0 -22
- package/src/utils/normalize-path.spec.js +0 -56
- package/src/utils/to-pascal-case.d.ts +0 -6
- package/src/utils/to-pascal-case.js +0 -26
- package/src/utils/to-pascal-case.spec.js +0 -15
- package/src/utils/to-spaced-json.d.ts +0 -17
- package/src/utils/to-spaced-json.js +0 -27
package/src/ajv.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import addFormats from 'ajv-formats';
|
|
2
|
+
import Ajv2020 from 'ajv/dist/2020.js';
|
|
3
|
+
import schema from '../schema/openapi-3-1/schema.js';
|
|
4
|
+
import schemaBase from '../schema/openapi-3-1/schema-base.js';
|
|
5
|
+
import vocabularySchema from '../schema/openapi-3-1/meta/base.js';
|
|
6
|
+
import dialectSchema from '../schema/openapi-3-1/dialect/base.js';
|
|
7
|
+
|
|
8
|
+
export const ajv = new Ajv2020({
|
|
9
|
+
strictTypes: false,
|
|
10
|
+
validateFormats: true,
|
|
11
|
+
allowUnionTypes: true,
|
|
12
|
+
allowMatchingProperties: true,
|
|
13
|
+
});
|
|
14
|
+
addFormats(ajv);
|
|
15
|
+
|
|
16
|
+
ajv.addFormat('media-range', {
|
|
17
|
+
type: 'string',
|
|
18
|
+
validate: value => {
|
|
19
|
+
return /^[a-z]+\/([a-z0-9\-+.]+|\*)$/i.test(value);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
ajv.addSchema(vocabularySchema, 'https://spec.openapis.org/oas/3.1/meta/base');
|
|
24
|
+
ajv.addSchema(dialectSchema, 'https://spec.openapis.org/oas/3.1/dialect/base');
|
|
25
|
+
ajv.addSchema(schemaBase, 'https://spec.openapis.org/oas/3.1/schema-base');
|
|
26
|
+
ajv.addSchema(schema, 'https://spec.openapis.org/oas/3.1/schema');
|
|
27
|
+
|
|
28
|
+
export const OA_DOCUMENT_OBJECT_JSON_SCHEMA_URI =
|
|
29
|
+
'https://spec.openapis.org/oas/3.1/schema';
|
|
30
|
+
|
|
31
|
+
// pre-compilation (170ms)
|
|
32
|
+
ajv.getSchema(OA_DOCUMENT_OBJECT_JSON_SCHEMA_URI);
|
package/src/errors/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './oa-
|
|
1
|
+
export * from './oa-document-object-validation-error.js';
|
package/src/errors/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './oa-
|
|
1
|
+
export * from './oa-document-object-validation-error.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {Errorf} from '@e22m4u/js-format';
|
|
3
|
+
import {OADocumentObjectValidationError} from './oa-document-object-validation-error.js';
|
|
4
|
+
|
|
5
|
+
describe('OADocumentObjectValidationError', function () {
|
|
6
|
+
it('should extend the Errorf class', function () {
|
|
7
|
+
const error = new OADocumentObjectValidationError();
|
|
8
|
+
expect(error).to.be.instanceof(Errorf);
|
|
9
|
+
});
|
|
10
|
+
});
|
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export * from './errors/index.js';
|
|
2
|
-
export * from './data-type/index.js';
|
|
3
2
|
export * from './oa-specification.js';
|
|
4
|
-
export * from './oa-document-scope.js';
|
|
5
3
|
export * from './json-pointer/index.js';
|
|
4
|
+
export * from './oa-operation-group.js';
|
|
6
5
|
export * from './oa-document-builder.js';
|
|
7
|
-
export * from './data-validation/index.js';
|
|
8
6
|
export * from './oa-document-object/index.js';
|
|
9
7
|
export * from './oa-reference-object/index.js';
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export * from './errors/index.js';
|
|
2
|
-
export * from './data-type/index.js';
|
|
3
2
|
export * from './oa-specification.js';
|
|
4
|
-
export * from './oa-document-scope.js';
|
|
5
3
|
export * from './json-pointer/index.js';
|
|
4
|
+
export * from './oa-operation-group.js';
|
|
6
5
|
export * from './oa-document-builder.js';
|
|
7
|
-
export * from './data-validation/index.js';
|
|
8
6
|
export * from './oa-document-object/index.js';
|
|
9
7
|
export * from './oa-reference-object/index.js';
|
|
@@ -37,7 +37,7 @@ export function resolveJsonPointer(document, pointer) {
|
|
|
37
37
|
// в противном случае выбрасывается ошибка
|
|
38
38
|
if (!pointer.startsWith('/')) {
|
|
39
39
|
throw new InvalidArgumentError(
|
|
40
|
-
'JSON pointer must start with
|
|
40
|
+
'JSON pointer must start with "/", but %v was given.',
|
|
41
41
|
pointer,
|
|
42
42
|
);
|
|
43
43
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {Optional} from './types.js';
|
|
2
2
|
import {Service, ServiceContainer} from '@e22m4u/js-service';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
OAOperationGroup,
|
|
6
|
+
OAOperationGroupOptions,
|
|
7
|
+
} from './oa-operation-group.js';
|
|
4
8
|
|
|
5
9
|
import {
|
|
6
10
|
OADocumentObject,
|
|
@@ -50,96 +54,15 @@ export declare const OA_COMPONENT_TYPES: OAComponentType[];
|
|
|
50
54
|
* Component type to components key map.
|
|
51
55
|
*/
|
|
52
56
|
export declare const OA_COMPONENT_TYPE_TO_COMPONENTS_KEY_MAP: {
|
|
53
|
-
[OAComponentType
|
|
54
|
-
[OAComponentType.RESPONSE]: 'responses';
|
|
55
|
-
[OAComponentType.PARAMETER]: 'parameters';
|
|
56
|
-
[OAComponentType.EXAMPLE]: 'examples';
|
|
57
|
-
[OAComponentType.REQUEST_BODY]: 'requestBodies';
|
|
58
|
-
[OAComponentType.HEADER]: 'headers';
|
|
59
|
-
[OAComponentType.SECURITY_SCHEME]: 'securitySchemes';
|
|
60
|
-
[OAComponentType.LINK]: 'links';
|
|
61
|
-
[OAComponentType.CALLBACK]: 'callbacks';
|
|
62
|
-
[OAComponentType.PATH_ITEM]: 'pathItems';
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Schema component definition.
|
|
67
|
-
*/
|
|
68
|
-
export type OASchemaComponentDefinition = {
|
|
69
|
-
name: string;
|
|
70
|
-
schema: OASchemaObject;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Response component definition.
|
|
75
|
-
*/
|
|
76
|
-
export type OAResponseComponentDefinition = {
|
|
77
|
-
name: string;
|
|
78
|
-
response: OAResponseObject | OAReferenceObject;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Parameter component definition.
|
|
83
|
-
*/
|
|
84
|
-
export type OAParameterComponentDefinition = {
|
|
85
|
-
name: string;
|
|
86
|
-
parameter: OAParameterObject | OAReferenceObject;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Example component definition.
|
|
91
|
-
*/
|
|
92
|
-
export type OAExampleComponentDefinition = {
|
|
93
|
-
name: string;
|
|
94
|
-
example: OAExampleObject | OAReferenceObject;
|
|
57
|
+
[k in OAComponentType]: string | undefined;
|
|
95
58
|
};
|
|
96
59
|
|
|
97
60
|
/**
|
|
98
|
-
*
|
|
61
|
+
* Component type to definition name map.
|
|
62
|
+
* "#/$defs/${name}"
|
|
99
63
|
*/
|
|
100
|
-
export
|
|
101
|
-
|
|
102
|
-
requestBody: OARequestBodyObject | OAReferenceObject;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Header component definition.
|
|
107
|
-
*/
|
|
108
|
-
export type OAHeaderComponentDefinition = {
|
|
109
|
-
name: string;
|
|
110
|
-
header: OAHeaderObject | OAReferenceObject;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Security scheme component definition.
|
|
115
|
-
*/
|
|
116
|
-
export type OASecuritySchemeComponentDefinition = {
|
|
117
|
-
name: string;
|
|
118
|
-
securityScheme: OASecuritySchemeObject | OAReferenceObject;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Link component definition.
|
|
123
|
-
*/
|
|
124
|
-
export type OALinkComponentDefinition = {
|
|
125
|
-
name: string;
|
|
126
|
-
link: OALinkObject | OAReferenceObject;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Callback component definition.
|
|
131
|
-
*/
|
|
132
|
-
export type OACallbackComponentDefinition = {
|
|
133
|
-
name: string;
|
|
134
|
-
callback: OACallbackObject | OAReferenceObject;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Path item component definition.
|
|
139
|
-
*/
|
|
140
|
-
export type OAPathItemComponentDefinition = {
|
|
141
|
-
name: string;
|
|
142
|
-
pathItem: OAPathItemObject | OAReferenceObject;
|
|
64
|
+
export declare const OA_COMPONENT_TYPE_TO_DEFINITION_NAME_MAP: {
|
|
65
|
+
[k in OAComponentType]: string | undefined;
|
|
143
66
|
};
|
|
144
67
|
|
|
145
68
|
/**
|
|
@@ -148,7 +71,7 @@ export type OAPathItemComponentDefinition = {
|
|
|
148
71
|
export type OAOperationDefinition = {
|
|
149
72
|
path: string;
|
|
150
73
|
method: OAOperationMethod;
|
|
151
|
-
operation
|
|
74
|
+
operation?: OAOperationObject;
|
|
152
75
|
};
|
|
153
76
|
|
|
154
77
|
/**
|
|
@@ -186,13 +109,138 @@ export declare class OADocumentBuilder extends Service {
|
|
|
186
109
|
document?: OADocumentInput,
|
|
187
110
|
);
|
|
188
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Get document object reference.
|
|
114
|
+
*/
|
|
115
|
+
getDocumentObjectRef(): OADocumentObject;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Define component (schema).
|
|
119
|
+
*
|
|
120
|
+
* @param type
|
|
121
|
+
* @param definition
|
|
122
|
+
*/
|
|
123
|
+
defineComponent(
|
|
124
|
+
type: typeof OAComponentType.SCHEMA,
|
|
125
|
+
name: string,
|
|
126
|
+
component: OASchemaObject | OAReferenceObject,
|
|
127
|
+
): this;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Define component (response).
|
|
131
|
+
*
|
|
132
|
+
* @param type
|
|
133
|
+
* @param definition
|
|
134
|
+
*/
|
|
135
|
+
defineComponent(
|
|
136
|
+
type: typeof OAComponentType.RESPONSE,
|
|
137
|
+
name: string,
|
|
138
|
+
component: OAResponseObject | OAReferenceObject,
|
|
139
|
+
): this;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Define component (parameter).
|
|
143
|
+
*
|
|
144
|
+
* @param type
|
|
145
|
+
* @param definition
|
|
146
|
+
*/
|
|
147
|
+
defineComponent(
|
|
148
|
+
type: typeof OAComponentType.PARAMETER,
|
|
149
|
+
name: string,
|
|
150
|
+
component: OAParameterObject | OAReferenceObject,
|
|
151
|
+
): this;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Define component (example).
|
|
155
|
+
*
|
|
156
|
+
* @param type
|
|
157
|
+
* @param definition
|
|
158
|
+
*/
|
|
159
|
+
defineComponent(
|
|
160
|
+
type: typeof OAComponentType.EXAMPLE,
|
|
161
|
+
name: string,
|
|
162
|
+
component: OAExampleObject | OAReferenceObject,
|
|
163
|
+
): this;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Define component (request body).
|
|
167
|
+
*
|
|
168
|
+
* @param type
|
|
169
|
+
* @param definition
|
|
170
|
+
*/
|
|
171
|
+
defineComponent(
|
|
172
|
+
type: typeof OAComponentType.REQUEST_BODY,
|
|
173
|
+
name: string,
|
|
174
|
+
component: OARequestBodyObject | OAReferenceObject,
|
|
175
|
+
): this;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Define component (header).
|
|
179
|
+
*
|
|
180
|
+
* @param type
|
|
181
|
+
* @param definition
|
|
182
|
+
*/
|
|
183
|
+
defineComponent(
|
|
184
|
+
type: typeof OAComponentType.HEADER,
|
|
185
|
+
name: string,
|
|
186
|
+
component: OAHeaderObject | OAReferenceObject,
|
|
187
|
+
): this;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Define component (security scheme).
|
|
191
|
+
*
|
|
192
|
+
* @param type
|
|
193
|
+
* @param definition
|
|
194
|
+
*/
|
|
195
|
+
defineComponent(
|
|
196
|
+
type: typeof OAComponentType.SECURITY_SCHEME,
|
|
197
|
+
name: string,
|
|
198
|
+
component: OASecuritySchemeObject | OAReferenceObject,
|
|
199
|
+
): this;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Define component (link).
|
|
203
|
+
*
|
|
204
|
+
* @param type
|
|
205
|
+
* @param definition
|
|
206
|
+
*/
|
|
207
|
+
defineComponent(
|
|
208
|
+
type: typeof OAComponentType.LINK,
|
|
209
|
+
name: string,
|
|
210
|
+
component: OALinkObject | OAReferenceObject,
|
|
211
|
+
): this;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Define component (callback).
|
|
215
|
+
*
|
|
216
|
+
* @param type
|
|
217
|
+
* @param definition
|
|
218
|
+
*/
|
|
219
|
+
defineComponent(
|
|
220
|
+
type: typeof OAComponentType.CALLBACK,
|
|
221
|
+
name: string,
|
|
222
|
+
component: OACallbackObject | OAReferenceObject,
|
|
223
|
+
): this;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Define component (path item).
|
|
227
|
+
*
|
|
228
|
+
* @param type
|
|
229
|
+
* @param definition
|
|
230
|
+
*/
|
|
231
|
+
defineComponent(
|
|
232
|
+
type: typeof OAComponentType.PATH_ITEM,
|
|
233
|
+
name: string,
|
|
234
|
+
component: OAPathItemObject | OAReferenceObject,
|
|
235
|
+
): this;
|
|
236
|
+
|
|
189
237
|
/**
|
|
190
238
|
* Define component.
|
|
191
239
|
*
|
|
192
240
|
* @param type
|
|
193
241
|
* @param definition
|
|
194
242
|
*/
|
|
195
|
-
defineComponent(type: OAComponentType,
|
|
243
|
+
defineComponent(type: OAComponentType, name: string, component: object): this;
|
|
196
244
|
|
|
197
245
|
/**
|
|
198
246
|
* Has component.
|
|
@@ -202,6 +250,116 @@ export declare class OADocumentBuilder extends Service {
|
|
|
202
250
|
*/
|
|
203
251
|
hasComponent(type: OAComponentType, name: string): boolean;
|
|
204
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Get component (schema).
|
|
255
|
+
*
|
|
256
|
+
* @param type
|
|
257
|
+
* @param definition
|
|
258
|
+
*/
|
|
259
|
+
getComponent(
|
|
260
|
+
type: typeof OAComponentType.SCHEMA,
|
|
261
|
+
name: string,
|
|
262
|
+
): OASchemaObject | OAReferenceObject;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Get component (response).
|
|
266
|
+
*
|
|
267
|
+
* @param type
|
|
268
|
+
* @param definition
|
|
269
|
+
*/
|
|
270
|
+
getComponent(
|
|
271
|
+
type: typeof OAComponentType.RESPONSE,
|
|
272
|
+
name: string,
|
|
273
|
+
): OAResponseObject | OAReferenceObject;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Get component (parameter).
|
|
277
|
+
*
|
|
278
|
+
* @param type
|
|
279
|
+
* @param definition
|
|
280
|
+
*/
|
|
281
|
+
getComponent(
|
|
282
|
+
type: typeof OAComponentType.PARAMETER,
|
|
283
|
+
name: string,
|
|
284
|
+
): OAParameterObject | OAReferenceObject;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Get component (example).
|
|
288
|
+
*
|
|
289
|
+
* @param type
|
|
290
|
+
* @param definition
|
|
291
|
+
*/
|
|
292
|
+
getComponent(
|
|
293
|
+
type: typeof OAComponentType.EXAMPLE,
|
|
294
|
+
name: string,
|
|
295
|
+
): OAExampleObject | OAReferenceObject;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Get component (request body).
|
|
299
|
+
*
|
|
300
|
+
* @param type
|
|
301
|
+
* @param definition
|
|
302
|
+
*/
|
|
303
|
+
getComponent(
|
|
304
|
+
type: typeof OAComponentType.REQUEST_BODY,
|
|
305
|
+
name: string,
|
|
306
|
+
): OARequestBodyObject | OAReferenceObject;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Get component (header).
|
|
310
|
+
*
|
|
311
|
+
* @param type
|
|
312
|
+
* @param definition
|
|
313
|
+
*/
|
|
314
|
+
getComponent(
|
|
315
|
+
type: typeof OAComponentType.HEADER,
|
|
316
|
+
name: string,
|
|
317
|
+
): OAHeaderObject | OAReferenceObject;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Get component (security scheme).
|
|
321
|
+
*
|
|
322
|
+
* @param type
|
|
323
|
+
* @param definition
|
|
324
|
+
*/
|
|
325
|
+
getComponent(
|
|
326
|
+
type: typeof OAComponentType.SECURITY_SCHEME,
|
|
327
|
+
name: string,
|
|
328
|
+
): OASecuritySchemeObject | OAReferenceObject;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Get component (link).
|
|
332
|
+
*
|
|
333
|
+
* @param type
|
|
334
|
+
* @param definition
|
|
335
|
+
*/
|
|
336
|
+
getComponent(
|
|
337
|
+
type: typeof OAComponentType.LINK,
|
|
338
|
+
name: string,
|
|
339
|
+
): OALinkObject | OAReferenceObject;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Get component (callback).
|
|
343
|
+
*
|
|
344
|
+
* @param type
|
|
345
|
+
* @param definition
|
|
346
|
+
*/
|
|
347
|
+
getComponent(
|
|
348
|
+
type: typeof OAComponentType.CALLBACK,
|
|
349
|
+
name: string,
|
|
350
|
+
): OACallbackObject | OAReferenceObject;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Get component (path item).
|
|
354
|
+
*
|
|
355
|
+
* @param type
|
|
356
|
+
* @param definition
|
|
357
|
+
*/
|
|
358
|
+
getComponent(
|
|
359
|
+
type: typeof OAComponentType.PATH_ITEM,
|
|
360
|
+
name: string,
|
|
361
|
+
): OAPathItemObject | OAReferenceObject;
|
|
362
|
+
|
|
205
363
|
/**
|
|
206
364
|
* Get component.
|
|
207
365
|
*
|
|
@@ -213,76 +371,109 @@ export declare class OADocumentBuilder extends Service {
|
|
|
213
371
|
/**
|
|
214
372
|
* Define schema component.
|
|
215
373
|
*
|
|
216
|
-
* @param
|
|
374
|
+
* @param name
|
|
375
|
+
* @param component
|
|
217
376
|
*/
|
|
218
|
-
defineSchemaComponent(
|
|
377
|
+
defineSchemaComponent(
|
|
378
|
+
name: string,
|
|
379
|
+
component: OASchemaObject | OAReferenceObject,
|
|
380
|
+
): this;
|
|
219
381
|
|
|
220
382
|
/**
|
|
221
383
|
* Define response component.
|
|
222
384
|
*
|
|
223
|
-
* @param
|
|
385
|
+
* @param name
|
|
386
|
+
* @param component
|
|
224
387
|
*/
|
|
225
|
-
defineResponseComponent(
|
|
388
|
+
defineResponseComponent(
|
|
389
|
+
name: string,
|
|
390
|
+
component: OAResponseObject | OAReferenceObject,
|
|
391
|
+
): this;
|
|
226
392
|
|
|
227
393
|
/**
|
|
228
394
|
* Define parameter component.
|
|
229
395
|
*
|
|
230
|
-
* @param
|
|
396
|
+
* @param name
|
|
397
|
+
* @param component
|
|
231
398
|
*/
|
|
232
|
-
defineParameterComponent(
|
|
399
|
+
defineParameterComponent(
|
|
400
|
+
name: string,
|
|
401
|
+
component: OAParameterObject | OAReferenceObject,
|
|
402
|
+
): this;
|
|
233
403
|
|
|
234
404
|
/**
|
|
235
405
|
* Define example component.
|
|
236
406
|
*
|
|
237
|
-
* @param
|
|
407
|
+
* @param name
|
|
408
|
+
* @param component
|
|
238
409
|
*/
|
|
239
|
-
defineExampleComponent(
|
|
410
|
+
defineExampleComponent(
|
|
411
|
+
name: string,
|
|
412
|
+
component: OAExampleObject | OAReferenceObject,
|
|
413
|
+
): this;
|
|
240
414
|
|
|
241
415
|
/**
|
|
242
416
|
* Define request body component.
|
|
243
417
|
*
|
|
244
|
-
* @param
|
|
418
|
+
* @param name
|
|
419
|
+
* @param component
|
|
245
420
|
*/
|
|
246
421
|
defineRequestBodyComponent(
|
|
247
|
-
|
|
422
|
+
name: string,
|
|
423
|
+
component: OARequestBodyObject | OAReferenceObject,
|
|
248
424
|
): this;
|
|
249
425
|
|
|
250
426
|
/**
|
|
251
427
|
* Define header component.
|
|
252
428
|
*
|
|
253
|
-
* @param
|
|
429
|
+
* @param name
|
|
430
|
+
* @param component
|
|
254
431
|
*/
|
|
255
|
-
defineHeaderComponent(
|
|
432
|
+
defineHeaderComponent(
|
|
433
|
+
name: string,
|
|
434
|
+
component: OAHeaderObject | OAReferenceObject,
|
|
435
|
+
): this;
|
|
256
436
|
|
|
257
437
|
/**
|
|
258
438
|
* Define security scheme component.
|
|
259
439
|
*
|
|
260
|
-
* @param
|
|
440
|
+
* @param name
|
|
441
|
+
* @param component
|
|
261
442
|
*/
|
|
262
443
|
defineSecuritySchemeComponent(
|
|
263
|
-
|
|
444
|
+
name: string,
|
|
445
|
+
component: OASecuritySchemeObject | OAReferenceObject,
|
|
264
446
|
): this;
|
|
265
447
|
|
|
266
448
|
/**
|
|
267
449
|
* Define link component.
|
|
268
450
|
*
|
|
269
|
-
* @param
|
|
451
|
+
* @param name
|
|
452
|
+
* @param component
|
|
270
453
|
*/
|
|
271
|
-
defineLinkComponent(
|
|
454
|
+
defineLinkComponent(
|
|
455
|
+
name: string,
|
|
456
|
+
component: OALinkObject | OAReferenceObject,
|
|
457
|
+
): this;
|
|
272
458
|
|
|
273
459
|
/**
|
|
274
460
|
* Define callback component.
|
|
275
461
|
*
|
|
276
|
-
* @param
|
|
462
|
+
* @param name
|
|
463
|
+
* @param component
|
|
277
464
|
*/
|
|
278
|
-
defineCallbackComponent(
|
|
465
|
+
defineCallbackComponent(
|
|
466
|
+
name: string,
|
|
467
|
+
component: OACallbackObject | OAReferenceObject,
|
|
468
|
+
): this;
|
|
279
469
|
|
|
280
470
|
/**
|
|
281
471
|
* Define path item component.
|
|
282
472
|
*
|
|
283
|
-
* @param
|
|
473
|
+
* @param name
|
|
474
|
+
* @param component
|
|
284
475
|
*/
|
|
285
|
-
definePathItemComponent(
|
|
476
|
+
definePathItemComponent(name: string, component: OAPathItemObject): this;
|
|
286
477
|
|
|
287
478
|
/**
|
|
288
479
|
* Define operation.
|
|
@@ -292,11 +483,11 @@ export declare class OADocumentBuilder extends Service {
|
|
|
292
483
|
defineOperation(operationDef: OAOperationDefinition): this;
|
|
293
484
|
|
|
294
485
|
/**
|
|
295
|
-
* Create
|
|
486
|
+
* Create operation group.
|
|
296
487
|
*
|
|
297
488
|
* @param options
|
|
298
489
|
*/
|
|
299
|
-
|
|
490
|
+
createOperationGroup(options?: OAOperationGroupOptions): OAOperationGroup;
|
|
300
491
|
|
|
301
492
|
/**
|
|
302
493
|
* Build.
|