@swagger-api/apidom-ns-openapi-3-0 0.77.0 → 0.78.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/CHANGELOG.md +11 -0
- package/README.md +2 -2
- package/cjs/elements/Schema.cjs +64 -0
- package/cjs/refractor/specification.cjs +64 -50
- package/cjs/refractor/visitors/SpecificationVisitor.cjs +5 -1
- package/dist/apidom-ns-openapi-3-0.browser.js +4407 -16851
- package/dist/apidom-ns-openapi-3-0.browser.min.js +1 -1
- package/es/elements/Schema.mjs +65 -0
- package/es/refractor/specification.mjs +64 -50
- package/es/refractor/visitors/SpecificationVisitor.mjs +6 -2
- package/package.json +7 -6
- package/types/dist.d.ts +53 -56
- package/cjs/refractor/visitors/open-api-3-0/schema/DefinitionsVisitor.cjs +0 -24
- package/cjs/refractor/visitors/open-api-3-0/schema/DependenciesVisitor.cjs +0 -24
- package/cjs/refractor/visitors/open-api-3-0/schema/PatternPropertiesVisitor.cjs +0 -24
- package/cjs/refractor/visitors/open-api-3-0/schema/inherited-fixed-fields.cjs +0 -14
- package/es/refractor/visitors/open-api-3-0/schema/DefinitionsVisitor.mjs +0 -19
- package/es/refractor/visitors/open-api-3-0/schema/DependenciesVisitor.mjs +0 -19
- package/es/refractor/visitors/open-api-3-0/schema/PatternPropertiesVisitor.mjs +0 -19
- package/es/refractor/visitors/open-api-3-0/schema/inherited-fixed-fields.mjs +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.78.0](https://github.com/swagger-api/apidom/compare/v0.77.0...v0.78.0) (2023-10-17)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **ns-openapi-3:** support only subset of JSON Schema Draft 4/5 ([#3265](https://github.com/swagger-api/apidom/issues/3265)) ([e8a19d1](https://github.com/swagger-api/apidom/commit/e8a19d18ad43959a688a004e5d277553b0a171ac))
|
|
11
|
+
- **types:** fix regression in @types/ramda@0.29.6 ([#3281](https://github.com/swagger-api/apidom/issues/3281)) ([c6c279f](https://github.com/swagger-api/apidom/commit/c6c279f526e07b16221d8c00dd0041eeb93e1290)), closes [#3279](https://github.com/swagger-api/apidom/issues/3279)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- scaffold OpenAPI 2.0 namespace package ([#3218](https://github.com/swagger-api/apidom/issues/3218)) ([d949353](https://github.com/swagger-api/apidom/commit/d949353f7779690414fb74aafedff230ddf77cd3)), closes [#3097](https://github.com/swagger-api/apidom/issues/3097)
|
|
16
|
+
|
|
6
17
|
# [0.77.0](https://github.com/swagger-api/apidom/compare/v0.76.2...v0.77.0) (2023-10-03)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @swagger-api/apidom-ns-openapi-3-0
|
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ import { isOpenApi3_0Element, OpenApi3_0Element } from '@swagger-api/apidom-ns-o
|
|
|
52
52
|
|
|
53
53
|
const openApiElement = new OpenApi3_0Element();
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
isOpenApi3_0Element(openApiElement); // => true
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Traversal
|
|
@@ -160,7 +160,7 @@ openapi: 3.0.3
|
|
|
160
160
|
info:
|
|
161
161
|
`;
|
|
162
162
|
const apiDOM = await parse(yamlDefinition);
|
|
163
|
-
const
|
|
163
|
+
const openApiElement = OpenApi3_0Element.refract(apiDOM.result, {
|
|
164
164
|
plugins: [refractorPluginReplaceEmptyElement()],
|
|
165
165
|
});
|
|
166
166
|
|
package/cjs/elements/Schema.cjs
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
+
var _apidomError = require("@swagger-api/apidom-error");
|
|
5
6
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
7
|
+
/* eslint-disable class-methods-use-this */
|
|
6
8
|
class Schema extends _apidomNsJsonSchemaDraft.JSONSchemaElement {
|
|
7
9
|
constructor(content, meta, attributes) {
|
|
8
10
|
super(content, meta, attributes);
|
|
@@ -10,6 +12,24 @@ class Schema extends _apidomNsJsonSchemaDraft.JSONSchemaElement {
|
|
|
10
12
|
this.classes.push('json-schema-draft-4');
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Core vocabulary
|
|
17
|
+
*
|
|
18
|
+
* URI: https://tools.ietf.org/html/draft-wright-json-schema-00
|
|
19
|
+
*/
|
|
20
|
+
get idProp() {
|
|
21
|
+
throw new _apidomError.UnsupportedOperationError('idProp getter in Schema class is not not supported.');
|
|
22
|
+
}
|
|
23
|
+
set idProp(idProps) {
|
|
24
|
+
throw new _apidomError.UnsupportedOperationError('idProp setter in Schema class is not not supported.');
|
|
25
|
+
}
|
|
26
|
+
get $schema() {
|
|
27
|
+
throw new _apidomError.UnsupportedOperationError('$schema getter in Schema class is not not supported.');
|
|
28
|
+
}
|
|
29
|
+
set $schema($schema) {
|
|
30
|
+
throw new _apidomError.UnsupportedOperationError('$schema setter in Schema class is not not supported.');
|
|
31
|
+
}
|
|
32
|
+
|
|
13
33
|
/**
|
|
14
34
|
* Validation keywords for arrays
|
|
15
35
|
*/
|
|
@@ -37,6 +57,18 @@ class Schema extends _apidomNsJsonSchemaDraft.JSONSchemaElement {
|
|
|
37
57
|
set additionalProperties(additionalProperties) {
|
|
38
58
|
this.set('additionalProperties', additionalProperties);
|
|
39
59
|
}
|
|
60
|
+
get patternProperties() {
|
|
61
|
+
throw new _apidomError.UnsupportedOperationError('patternProperties getter in Schema class is not not supported.');
|
|
62
|
+
}
|
|
63
|
+
set patternProperties(patternProperties) {
|
|
64
|
+
throw new _apidomError.UnsupportedOperationError('patternProperties setter in Schema class is not not supported.');
|
|
65
|
+
}
|
|
66
|
+
get dependencies() {
|
|
67
|
+
throw new _apidomError.UnsupportedOperationError('dependencies getter in Schema class is not not supported.');
|
|
68
|
+
}
|
|
69
|
+
set dependencies(dependencies) {
|
|
70
|
+
throw new _apidomError.UnsupportedOperationError('dependencies setter in Schema class is not not supported.');
|
|
71
|
+
}
|
|
40
72
|
|
|
41
73
|
/**
|
|
42
74
|
* Validation keywords for any instance type
|
|
@@ -54,6 +86,37 @@ class Schema extends _apidomNsJsonSchemaDraft.JSONSchemaElement {
|
|
|
54
86
|
set not(not) {
|
|
55
87
|
this.set('not', not);
|
|
56
88
|
}
|
|
89
|
+
get definitions() {
|
|
90
|
+
throw new _apidomError.UnsupportedOperationError('definitions getter in Schema class is not not supported.');
|
|
91
|
+
}
|
|
92
|
+
set definitions(definitions) {
|
|
93
|
+
throw new _apidomError.UnsupportedOperationError('definitions setter in Schema class is not not supported.');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* JSON Hyper-Schema
|
|
98
|
+
*
|
|
99
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-00
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
get base() {
|
|
103
|
+
throw new _apidomError.UnsupportedOperationError('base getter in Schema class is not not supported.');
|
|
104
|
+
}
|
|
105
|
+
set base(base) {
|
|
106
|
+
throw new _apidomError.UnsupportedOperationError('base setter in Schema class is not not supported.');
|
|
107
|
+
}
|
|
108
|
+
get links() {
|
|
109
|
+
throw new _apidomError.UnsupportedOperationError('links getter in Schema class is not not supported.');
|
|
110
|
+
}
|
|
111
|
+
set links(links) {
|
|
112
|
+
throw new _apidomError.UnsupportedOperationError('links setter in Schema class is not not supported.');
|
|
113
|
+
}
|
|
114
|
+
get media() {
|
|
115
|
+
throw new _apidomError.UnsupportedOperationError('media getter in Schema class is not not supported.');
|
|
116
|
+
}
|
|
117
|
+
set media(media) {
|
|
118
|
+
throw new _apidomError.UnsupportedOperationError('media setter in Schema class is not not supported.');
|
|
119
|
+
}
|
|
57
120
|
|
|
58
121
|
/**
|
|
59
122
|
* OpenAPI vocabulary
|
|
@@ -102,4 +165,5 @@ class Schema extends _apidomNsJsonSchemaDraft.JSONSchemaElement {
|
|
|
102
165
|
this.set('deprecated', deprecated);
|
|
103
166
|
}
|
|
104
167
|
}
|
|
168
|
+
/* eslint-disable class-methods-use-this */
|
|
105
169
|
var _default = exports.default = Schema;
|
|
@@ -75,17 +75,14 @@ var _index15 = _interopRequireDefault(require("./visitors/open-api-3-0/schema/in
|
|
|
75
75
|
var _AllOfVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/AllOfVisitor.cjs"));
|
|
76
76
|
var _AnyOfVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/AnyOfVisitor.cjs"));
|
|
77
77
|
var _OneOfVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/OneOfVisitor.cjs"));
|
|
78
|
-
var _DefinitionsVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/DefinitionsVisitor.cjs"));
|
|
79
|
-
var _DependenciesVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/DependenciesVisitor.cjs"));
|
|
80
78
|
var _ItemsVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/ItemsVisitor.cjs"));
|
|
81
79
|
var _PropertiesVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/PropertiesVisitor.cjs"));
|
|
82
|
-
var _PatternPropertiesVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/PatternPropertiesVisitor.cjs"));
|
|
83
80
|
var _TypeVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/TypeVisitor.cjs"));
|
|
84
81
|
var _NullableVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/NullableVisitor.cjs"));
|
|
85
82
|
var _WriteOnlyVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/WriteOnlyVisitor.cjs"));
|
|
86
83
|
var _ExampleVisitor3 = _interopRequireDefault(require("./visitors/open-api-3-0/schema/ExampleVisitor.cjs"));
|
|
87
84
|
var _DeprecatedVisitor3 = _interopRequireDefault(require("./visitors/open-api-3-0/schema/DeprecatedVisitor.cjs"));
|
|
88
|
-
var
|
|
85
|
+
var _SchemaOrReferenceVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/schema/SchemaOrReferenceVisitor.cjs"));
|
|
89
86
|
var _index16 = _interopRequireDefault(require("./visitors/open-api-3-0/distriminator/index.cjs"));
|
|
90
87
|
var _PropertyNameVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/distriminator/PropertyNameVisitor.cjs"));
|
|
91
88
|
var _MappingVisitor = _interopRequireDefault(require("./visitors/open-api-3-0/distriminator/MappingVisitor.cjs"));
|
|
@@ -175,46 +172,9 @@ var _TagsVisitor2 = _interopRequireDefault(require("./visitors/open-api-3-0/Tags
|
|
|
175
172
|
* Note: Specification object allows to use absolute internal JSON pointers.
|
|
176
173
|
*/
|
|
177
174
|
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
$ref: _$RefVisitor.default
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
const SchemaSpecification = {
|
|
185
|
-
$visitor: _index15.default,
|
|
186
|
-
fixedFields: {
|
|
187
|
-
..._inheritedFixedFields.default,
|
|
188
|
-
// validation vocabulary
|
|
189
|
-
// validation keywords for any instance type
|
|
190
|
-
allOf: _AllOfVisitor.default,
|
|
191
|
-
anyOf: _AnyOfVisitor.default,
|
|
192
|
-
oneOf: _OneOfVisitor.default,
|
|
193
|
-
definitions: _DefinitionsVisitor.default,
|
|
194
|
-
// validation keywords for arrays
|
|
195
|
-
items: _ItemsVisitor.default,
|
|
196
|
-
// Validation keywords for objects
|
|
197
|
-
dependencies: _DependenciesVisitor.default,
|
|
198
|
-
properties: _PropertiesVisitor.default,
|
|
199
|
-
patternProperties: _PatternPropertiesVisitor.default,
|
|
200
|
-
// validation keywords for any instance type
|
|
201
|
-
type: _TypeVisitor.default,
|
|
202
|
-
// OpenAPI vocabulary
|
|
203
|
-
nullable: _NullableVisitor.default,
|
|
204
|
-
discriminator: {
|
|
205
|
-
$ref: '#/visitors/document/objects/Discriminator'
|
|
206
|
-
},
|
|
207
|
-
writeOnly: _WriteOnlyVisitor.default,
|
|
208
|
-
xml: {
|
|
209
|
-
$ref: '#/visitors/document/objects/XML'
|
|
210
|
-
},
|
|
211
|
-
externalDocs: {
|
|
212
|
-
$ref: '#/visitors/document/objects/ExternalDocumentation'
|
|
213
|
-
},
|
|
214
|
-
example: _ExampleVisitor3.default,
|
|
215
|
-
deprecated: _DeprecatedVisitor3.default
|
|
216
|
-
}
|
|
217
|
-
};
|
|
175
|
+
const {
|
|
176
|
+
fixedFields: jsonSchemaFixedFields
|
|
177
|
+
} = _apidomNsJsonSchemaDraft.specificationObj.visitors.document.objects.JSONSchema;
|
|
218
178
|
const specification = {
|
|
219
179
|
visitors: {
|
|
220
180
|
value: _FallbackVisitor.default,
|
|
@@ -477,12 +437,66 @@ const specification = {
|
|
|
477
437
|
}
|
|
478
438
|
}
|
|
479
439
|
},
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
440
|
+
Reference: {
|
|
441
|
+
$visitor: _index12.default,
|
|
442
|
+
fixedFields: {
|
|
443
|
+
$ref: _$RefVisitor.default
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
JSONSchema: {
|
|
447
|
+
$ref: '#/visitors/document/objects/Schema'
|
|
448
|
+
},
|
|
449
|
+
JSONReference: {
|
|
450
|
+
$ref: '#/visitors/document/objects/Reference'
|
|
451
|
+
},
|
|
452
|
+
Schema: {
|
|
453
|
+
$visitor: _index15.default,
|
|
454
|
+
fixedFields: {
|
|
455
|
+
// the following properties are taken directly from the JSON Schema definition and follow the same specifications
|
|
456
|
+
title: jsonSchemaFixedFields.title,
|
|
457
|
+
multipleOf: jsonSchemaFixedFields.multipleOf,
|
|
458
|
+
maximum: jsonSchemaFixedFields.maximum,
|
|
459
|
+
exclusiveMaximum: jsonSchemaFixedFields.exclusiveMaximum,
|
|
460
|
+
minimum: jsonSchemaFixedFields.minimum,
|
|
461
|
+
exclusiveMinimum: jsonSchemaFixedFields.exclusiveMinimum,
|
|
462
|
+
maxLength: jsonSchemaFixedFields.maxLength,
|
|
463
|
+
minLength: jsonSchemaFixedFields.minLength,
|
|
464
|
+
pattern: jsonSchemaFixedFields.pattern,
|
|
465
|
+
maxItems: jsonSchemaFixedFields.maxItems,
|
|
466
|
+
minItems: jsonSchemaFixedFields.minItems,
|
|
467
|
+
uniqueItems: jsonSchemaFixedFields.uniqueItems,
|
|
468
|
+
maxProperties: jsonSchemaFixedFields.maxProperties,
|
|
469
|
+
minProperties: jsonSchemaFixedFields.minProperties,
|
|
470
|
+
required: jsonSchemaFixedFields.required,
|
|
471
|
+
enum: jsonSchemaFixedFields.enum,
|
|
472
|
+
// the following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification
|
|
473
|
+
type: _TypeVisitor.default,
|
|
474
|
+
allOf: _AllOfVisitor.default,
|
|
475
|
+
anyOf: _AnyOfVisitor.default,
|
|
476
|
+
oneOf: _OneOfVisitor.default,
|
|
477
|
+
not: _SchemaOrReferenceVisitor.default,
|
|
478
|
+
items: _ItemsVisitor.default,
|
|
479
|
+
properties: _PropertiesVisitor.default,
|
|
480
|
+
additionalProperties: _SchemaOrReferenceVisitor.default,
|
|
481
|
+
description: jsonSchemaFixedFields.description,
|
|
482
|
+
format: jsonSchemaFixedFields.format,
|
|
483
|
+
default: jsonSchemaFixedFields.default,
|
|
484
|
+
// OpenAPI vocabulary
|
|
485
|
+
nullable: _NullableVisitor.default,
|
|
486
|
+
discriminator: {
|
|
487
|
+
$ref: '#/visitors/document/objects/Discriminator'
|
|
488
|
+
},
|
|
489
|
+
writeOnly: _WriteOnlyVisitor.default,
|
|
490
|
+
xml: {
|
|
491
|
+
$ref: '#/visitors/document/objects/XML'
|
|
492
|
+
},
|
|
493
|
+
externalDocs: {
|
|
494
|
+
$ref: '#/visitors/document/objects/ExternalDocumentation'
|
|
495
|
+
},
|
|
496
|
+
example: _ExampleVisitor3.default,
|
|
497
|
+
deprecated: _DeprecatedVisitor3.default
|
|
498
|
+
}
|
|
499
|
+
},
|
|
486
500
|
Discriminator: {
|
|
487
501
|
$visitor: _index16.default,
|
|
488
502
|
fixedFields: {
|
|
@@ -37,7 +37,11 @@ const SpecificationVisitor = (0, _stampit.default)(_Visitor.default, {
|
|
|
37
37
|
return (0, _ramda.pick)(this.passingOptionsNames, this);
|
|
38
38
|
},
|
|
39
39
|
retrieveFixedFields(specPath) {
|
|
40
|
-
|
|
40
|
+
const fixedFields = (0, _ramda.path)(['visitors', ...specPath, 'fixedFields'], this.specObj);
|
|
41
|
+
if (typeof fixedFields === 'object' && fixedFields !== null) {
|
|
42
|
+
return Object.keys(fixedFields);
|
|
43
|
+
}
|
|
44
|
+
return [];
|
|
41
45
|
},
|
|
42
46
|
retrieveVisitor(specPath) {
|
|
43
47
|
if ((0, _ramda.pathSatisfies)(_ramdaAdjunct.isFunction, ['visitors', ...specPath], this.specObj)) {
|