@speclynx/apidom-ns-json-schema-draft-7 4.0.1 → 4.0.3
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 +10 -0
- package/package.json +8 -9
- package/src/elements/JSONSchema.cjs +122 -0
- package/src/elements/JSONSchema.mjs +119 -0
- package/src/elements/JSONSchema.ts +166 -0
- package/src/elements/LinkDescription.cjs +138 -0
- package/src/elements/LinkDescription.mjs +134 -0
- package/src/elements/LinkDescription.ts +194 -0
- package/src/index.cjs +42 -0
- package/src/index.mjs +13 -0
- package/src/index.ts +79 -0
- package/src/media-types.cjs +34 -0
- package/src/media-types.mjs +30 -0
- package/src/media-types.ts +40 -0
- package/src/namespace.cjs +23 -0
- package/src/namespace.mjs +18 -0
- package/src/namespace.ts +22 -0
- package/src/predicates.cjs +22 -0
- package/src/predicates.mjs +13 -0
- package/src/predicates.ts +20 -0
- package/src/refractor/index.cjs +76 -0
- package/src/refractor/index.mjs +67 -0
- package/src/refractor/index.ts +90 -0
- package/src/refractor/inspect.cjs +46 -0
- package/src/refractor/inspect.mjs +39 -0
- package/src/refractor/inspect.ts +51 -0
- package/src/refractor/plugins/replace-empty-element.cjs +235 -0
- package/src/refractor/plugins/replace-empty-element.mjs +229 -0
- package/src/refractor/plugins/replace-empty-element.ts +260 -0
- package/src/refractor/specification.cjs +15 -0
- package/src/refractor/specification.mjs +10 -0
- package/src/refractor/specification.ts +88 -0
- package/src/refractor/toolbox.cjs +26 -0
- package/src/refractor/toolbox.mjs +19 -0
- package/src/refractor/toolbox.ts +23 -0
- package/src/refractor/visitors/json-schema/index.cjs +20 -0
- package/src/refractor/visitors/json-schema/index.mjs +15 -0
- package/src/refractor/visitors/json-schema/index.ts +27 -0
- package/src/refractor/visitors/json-schema/link-description/index.cjs +17 -0
- package/src/refractor/visitors/json-schema/link-description/index.mjs +12 -0
- package/src/refractor/visitors/json-schema/link-description/index.ts +22 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { UnsupportedOperationError } from '@speclynx/apidom-error';
|
|
2
|
+
import { LinkDescriptionElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
3
|
+
/**
|
|
4
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-01#section-6
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
class LinkDescription extends LinkDescriptionElement {
|
|
9
|
+
/**
|
|
10
|
+
* Link context.
|
|
11
|
+
*
|
|
12
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.1
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
get anchor() {
|
|
16
|
+
return this.get('anchor');
|
|
17
|
+
}
|
|
18
|
+
set anchor(anchor) {
|
|
19
|
+
this.set('anchor', anchor);
|
|
20
|
+
}
|
|
21
|
+
get anchorPointer() {
|
|
22
|
+
return this.get('anchorPointer');
|
|
23
|
+
}
|
|
24
|
+
set anchorPointer(anchorPointer) {
|
|
25
|
+
this.set('anchorPointer', anchorPointer);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Adjusting URI Template Resolution.
|
|
30
|
+
*
|
|
31
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.4
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
get templatePointers() {
|
|
35
|
+
return this.get('templatePointers');
|
|
36
|
+
}
|
|
37
|
+
set templatePointers(templatePointers) {
|
|
38
|
+
this.set('templatePointers', templatePointers);
|
|
39
|
+
}
|
|
40
|
+
get templateRequired() {
|
|
41
|
+
return this.get('templateRequired');
|
|
42
|
+
}
|
|
43
|
+
set templateRequired(templateRequired) {
|
|
44
|
+
this.set('templateRequired', templateRequired);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Link Target Attributes.
|
|
49
|
+
*
|
|
50
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.5
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
get targetSchema() {
|
|
54
|
+
return this.get('targetSchema');
|
|
55
|
+
}
|
|
56
|
+
set targetSchema(targetSchema) {
|
|
57
|
+
this.set('targetSchema', targetSchema);
|
|
58
|
+
}
|
|
59
|
+
get mediaType() {
|
|
60
|
+
throw new UnsupportedOperationError('mediaType keyword from Hyper-Schema vocabulary has been renamed to targetMediaType.');
|
|
61
|
+
}
|
|
62
|
+
set mediaType(mediaType) {
|
|
63
|
+
throw new UnsupportedOperationError('mediaType keyword from Hyper-Schema vocabulary has been renamed to targetMediaType.');
|
|
64
|
+
}
|
|
65
|
+
get targetMediaType() {
|
|
66
|
+
return this.get('targetMediaType');
|
|
67
|
+
}
|
|
68
|
+
set targetMediaType(targetMediaType) {
|
|
69
|
+
this.set('targetMediaType', targetMediaType);
|
|
70
|
+
}
|
|
71
|
+
get targetHints() {
|
|
72
|
+
return this.get('targetHints');
|
|
73
|
+
}
|
|
74
|
+
set targetHints(targetHints) {
|
|
75
|
+
this.set('targetHints', targetHints);
|
|
76
|
+
}
|
|
77
|
+
get description() {
|
|
78
|
+
return this.get('description');
|
|
79
|
+
}
|
|
80
|
+
set description(description) {
|
|
81
|
+
this.set('description', description);
|
|
82
|
+
}
|
|
83
|
+
get $comment() {
|
|
84
|
+
return this.get('$comment');
|
|
85
|
+
}
|
|
86
|
+
set $comment($comment) {
|
|
87
|
+
this.set('$comment', $comment);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Link Input.
|
|
92
|
+
*
|
|
93
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.6
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
get hrefSchema() {
|
|
97
|
+
return this.get('hrefSchema');
|
|
98
|
+
}
|
|
99
|
+
set hrefSchema(hrefSchema) {
|
|
100
|
+
this.set('hrefSchema', hrefSchema);
|
|
101
|
+
}
|
|
102
|
+
get headerSchema() {
|
|
103
|
+
return this.get('headerSchema');
|
|
104
|
+
}
|
|
105
|
+
set headerSchema(headerSchema) {
|
|
106
|
+
this.set('headerSchema', headerSchema);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Submitting Data for Processing.
|
|
111
|
+
*
|
|
112
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.6.4
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
get submissionSchema() {
|
|
116
|
+
return this.get('submissionSchema');
|
|
117
|
+
}
|
|
118
|
+
set submissionSchema(submissionSchema) {
|
|
119
|
+
this.set('submissionSchema', submissionSchema);
|
|
120
|
+
}
|
|
121
|
+
get submissionEncType() {
|
|
122
|
+
throw new UnsupportedOperationError('submissionEncType keyword from Hyper-Schema vocabulary has been renamed to submissionMediaType.');
|
|
123
|
+
}
|
|
124
|
+
set submissionEncType(submissionEncType) {
|
|
125
|
+
throw new UnsupportedOperationError('submissionEncType keyword from Hyper-Schema vocabulary has been renamed to submissionMediaType.');
|
|
126
|
+
}
|
|
127
|
+
get submissionMediaType() {
|
|
128
|
+
return this.get('submissionMediaType');
|
|
129
|
+
}
|
|
130
|
+
set submissionMediaType(submissionMediaType) {
|
|
131
|
+
this.set('submissionMediaType', submissionMediaType);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export default LinkDescription;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StringElement,
|
|
3
|
+
ObjectElement,
|
|
4
|
+
ArrayElement,
|
|
5
|
+
BooleanElement,
|
|
6
|
+
} from '@speclynx/apidom-datamodel';
|
|
7
|
+
import { UnsupportedOperationError } from '@speclynx/apidom-error';
|
|
8
|
+
import {
|
|
9
|
+
LinkDescriptionElement,
|
|
10
|
+
JSONReferenceElement,
|
|
11
|
+
} from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
12
|
+
|
|
13
|
+
import JSONSchema from './JSONSchema.ts';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-01#section-6
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
class LinkDescription extends LinkDescriptionElement {
|
|
21
|
+
/**
|
|
22
|
+
* Link context.
|
|
23
|
+
*
|
|
24
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.1
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
get anchor(): StringElement | undefined {
|
|
28
|
+
return this.get('anchor') as StringElement | undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set anchor(anchor: StringElement | undefined) {
|
|
32
|
+
this.set('anchor', anchor);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get anchorPointer(): StringElement | undefined {
|
|
36
|
+
return this.get('anchorPointer') as StringElement | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
set anchorPointer(anchorPointer: StringElement | undefined) {
|
|
40
|
+
this.set('anchorPointer', anchorPointer);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Adjusting URI Template Resolution.
|
|
45
|
+
*
|
|
46
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.4
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
get templatePointers(): ObjectElement | undefined {
|
|
50
|
+
return this.get('templatePointers') as ObjectElement | undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set templatePointers(templatePointers: ObjectElement | undefined) {
|
|
54
|
+
this.set('templatePointers', templatePointers);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get templateRequired(): ArrayElement | undefined {
|
|
58
|
+
return this.get('templateRequired') as ArrayElement | undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
set templateRequired(templateRequired: ArrayElement | undefined) {
|
|
62
|
+
this.set('templateRequired', templateRequired);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Link Target Attributes.
|
|
67
|
+
*
|
|
68
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.5
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
get targetSchema(): JSONSchema | BooleanElement | JSONReferenceElement | undefined {
|
|
72
|
+
return this.get('targetSchema') as
|
|
73
|
+
| JSONSchema
|
|
74
|
+
| BooleanElement
|
|
75
|
+
| JSONReferenceElement
|
|
76
|
+
| undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set targetSchema(targetSchema: JSONSchema | BooleanElement | JSONReferenceElement | undefined) {
|
|
80
|
+
this.set('targetSchema', targetSchema);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get mediaType(): StringElement | undefined {
|
|
84
|
+
throw new UnsupportedOperationError(
|
|
85
|
+
'mediaType keyword from Hyper-Schema vocabulary has been renamed to targetMediaType.',
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
set mediaType(mediaType: StringElement | undefined) {
|
|
90
|
+
throw new UnsupportedOperationError(
|
|
91
|
+
'mediaType keyword from Hyper-Schema vocabulary has been renamed to targetMediaType.',
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get targetMediaType(): StringElement | undefined {
|
|
96
|
+
return this.get('targetMediaType') as StringElement | undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
set targetMediaType(targetMediaType: StringElement | undefined) {
|
|
100
|
+
this.set('targetMediaType', targetMediaType);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
get targetHints(): ObjectElement | undefined {
|
|
104
|
+
return this.get('targetHints') as ObjectElement | undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
set targetHints(targetHints: ObjectElement | undefined) {
|
|
108
|
+
this.set('targetHints', targetHints);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get description(): StringElement | undefined {
|
|
112
|
+
return this.get('description') as StringElement | undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
set description(description: StringElement | undefined) {
|
|
116
|
+
this.set('description', description);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get $comment(): StringElement | undefined {
|
|
120
|
+
return this.get('$comment') as StringElement | undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
set $comment($comment: StringElement | undefined) {
|
|
124
|
+
this.set('$comment', $comment);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Link Input.
|
|
129
|
+
*
|
|
130
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.6
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
get hrefSchema(): JSONSchema | BooleanElement | JSONReferenceElement | undefined {
|
|
134
|
+
return this.get('hrefSchema') as JSONSchema | BooleanElement | JSONReferenceElement | undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
set hrefSchema(hrefSchema: JSONSchema | BooleanElement | JSONReferenceElement | undefined) {
|
|
138
|
+
this.set('hrefSchema', hrefSchema);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get headerSchema(): JSONSchema | BooleanElement | JSONReferenceElement | undefined {
|
|
142
|
+
return this.get('headerSchema') as
|
|
143
|
+
| JSONSchema
|
|
144
|
+
| BooleanElement
|
|
145
|
+
| JSONReferenceElement
|
|
146
|
+
| undefined;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
set headerSchema(headerSchema: JSONSchema | BooleanElement | JSONReferenceElement | undefined) {
|
|
150
|
+
this.set('headerSchema', headerSchema);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Submitting Data for Processing.
|
|
155
|
+
*
|
|
156
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-hyperschema-01#section-6.6.4
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
get submissionSchema(): JSONSchema | BooleanElement | JSONReferenceElement | undefined {
|
|
160
|
+
return this.get('submissionSchema') as
|
|
161
|
+
| JSONSchema
|
|
162
|
+
| BooleanElement
|
|
163
|
+
| JSONReferenceElement
|
|
164
|
+
| undefined;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
set submissionSchema(
|
|
168
|
+
submissionSchema: JSONSchema | BooleanElement | JSONReferenceElement | undefined,
|
|
169
|
+
) {
|
|
170
|
+
this.set('submissionSchema', submissionSchema);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
get submissionEncType(): StringElement | undefined {
|
|
174
|
+
throw new UnsupportedOperationError(
|
|
175
|
+
'submissionEncType keyword from Hyper-Schema vocabulary has been renamed to submissionMediaType.',
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
set submissionEncType(submissionEncType: StringElement | undefined) {
|
|
180
|
+
throw new UnsupportedOperationError(
|
|
181
|
+
'submissionEncType keyword from Hyper-Schema vocabulary has been renamed to submissionMediaType.',
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
get submissionMediaType(): StringElement | undefined {
|
|
186
|
+
return this.get('submissionMediaType') as StringElement | undefined;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
set submissionMediaType(submissionMediaType: StringElement | undefined) {
|
|
190
|
+
this.set('submissionMediaType', submissionMediaType);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export default LinkDescription;
|
package/src/index.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.specificationObj = exports.refractorPluginReplaceEmptyElement = exports.refractLinkDescription = exports.refractJSONSchema = exports.refract = exports.mediaTypes = exports.isLinkDescriptionElement = exports.isJSONSchemaElement = exports.isJSONReferenceLikeElement = exports.isJSONReferenceElement = exports.isBooleanJSONSchemaElement = exports.default = exports.Visitor = exports.SpecificationVisitor = exports.PatternedFieldsVisitor = exports.ParentSchemaAwareVisitor = exports.MapVisitor = exports.LinkDescriptionVisitor = exports.LinkDescriptionElement = exports.JSONSchemaVisitor = exports.JSONSchemaElement = exports.JSONSchemaDraft7MediaTypes = exports.JSONReferenceElement = exports.FixedFieldsVisitor = exports.FallbackVisitor = exports.AlternatingVisitor = void 0;
|
|
7
|
+
var _mediaTypes = _interopRequireWildcard(require("./media-types.cjs"));
|
|
8
|
+
exports.mediaTypes = _mediaTypes.default;
|
|
9
|
+
exports.JSONSchemaDraft7MediaTypes = _mediaTypes.JSONSchemaDraft7MediaTypes;
|
|
10
|
+
var _namespace = _interopRequireDefault(require("./namespace.cjs"));
|
|
11
|
+
exports.default = _namespace.default;
|
|
12
|
+
var _replaceEmptyElement = _interopRequireDefault(require("./refractor/plugins/replace-empty-element.cjs"));
|
|
13
|
+
exports.refractorPluginReplaceEmptyElement = _replaceEmptyElement.default;
|
|
14
|
+
var _index = _interopRequireWildcard(require("./refractor/index.cjs"));
|
|
15
|
+
exports.refract = _index.default;
|
|
16
|
+
exports.refractJSONSchema = _index.refractJSONSchema;
|
|
17
|
+
exports.refractLinkDescription = _index.refractLinkDescription;
|
|
18
|
+
var _specification = _interopRequireDefault(require("./refractor/specification.cjs"));
|
|
19
|
+
exports.specificationObj = _specification.default;
|
|
20
|
+
var _predicates = require("./predicates.cjs");
|
|
21
|
+
exports.isBooleanJSONSchemaElement = _predicates.isBooleanJSONSchemaElement;
|
|
22
|
+
exports.isJSONReferenceElement = _predicates.isJSONReferenceElement;
|
|
23
|
+
exports.isJSONSchemaElement = _predicates.isJSONSchemaElement;
|
|
24
|
+
exports.isLinkDescriptionElement = _predicates.isLinkDescriptionElement;
|
|
25
|
+
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-6");
|
|
26
|
+
exports.isJSONReferenceLikeElement = _apidomNsJsonSchemaDraft.isJSONReferenceLikeElement;
|
|
27
|
+
exports.SpecificationVisitor = _apidomNsJsonSchemaDraft.SpecificationVisitor;
|
|
28
|
+
exports.FallbackVisitor = _apidomNsJsonSchemaDraft.FallbackVisitor;
|
|
29
|
+
exports.FixedFieldsVisitor = _apidomNsJsonSchemaDraft.FixedFieldsVisitor;
|
|
30
|
+
exports.PatternedFieldsVisitor = _apidomNsJsonSchemaDraft.PatternedFieldsVisitor;
|
|
31
|
+
exports.MapVisitor = _apidomNsJsonSchemaDraft.MapVisitor;
|
|
32
|
+
exports.AlternatingVisitor = _apidomNsJsonSchemaDraft.AlternatingVisitor;
|
|
33
|
+
exports.ParentSchemaAwareVisitor = _apidomNsJsonSchemaDraft.ParentSchemaAwareVisitor;
|
|
34
|
+
exports.Visitor = _apidomNsJsonSchemaDraft.Visitor;
|
|
35
|
+
var _index2 = _interopRequireDefault(require("./refractor/visitors/json-schema/index.cjs"));
|
|
36
|
+
exports.JSONSchemaVisitor = _index2.default;
|
|
37
|
+
var _index3 = _interopRequireDefault(require("./refractor/visitors/json-schema/link-description/index.cjs"));
|
|
38
|
+
exports.LinkDescriptionVisitor = _index3.default;
|
|
39
|
+
var _inspect = require("./refractor/inspect.cjs");
|
|
40
|
+
exports.JSONSchemaElement = _inspect.JSONSchemaElement;
|
|
41
|
+
exports.JSONReferenceElement = _inspect.JSONReferenceElement;
|
|
42
|
+
exports.LinkDescriptionElement = _inspect.LinkDescriptionElement;
|
package/src/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as mediaTypes, JSONSchemaDraft7MediaTypes } from "./media-types.mjs";
|
|
2
|
+
export { default } from "./namespace.mjs";
|
|
3
|
+
export { default as refractorPluginReplaceEmptyElement } from "./refractor/plugins/replace-empty-element.mjs";
|
|
4
|
+
export { default as refract, refractJSONSchema, refractLinkDescription } from "./refractor/index.mjs";
|
|
5
|
+
export { default as specificationObj } from "./refractor/specification.mjs";
|
|
6
|
+
export { isBooleanJSONSchemaElement, isJSONReferenceElement, isJSONSchemaElement, isLinkDescriptionElement } from "./predicates.mjs";
|
|
7
|
+
export { isJSONReferenceLikeElement, SpecificationVisitor, FallbackVisitor, FixedFieldsVisitor, PatternedFieldsVisitor, MapVisitor, AlternatingVisitor, ParentSchemaAwareVisitor, Visitor } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
8
|
+
export { default as JSONSchemaVisitor } from "./refractor/visitors/json-schema/index.mjs";
|
|
9
|
+
export { default as LinkDescriptionVisitor } from "./refractor/visitors/json-schema/link-description/index.mjs";
|
|
10
|
+
/**
|
|
11
|
+
* JSON Schema Draft 7 specification elements.
|
|
12
|
+
*/
|
|
13
|
+
export { JSONSchemaElement, JSONReferenceElement, LinkDescriptionElement } from "./refractor/inspect.mjs";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export { default as mediaTypes, JSONSchemaDraft7MediaTypes } from './media-types.ts';
|
|
2
|
+
export type { Format } from './media-types.ts';
|
|
3
|
+
|
|
4
|
+
export { default } from './namespace.ts';
|
|
5
|
+
|
|
6
|
+
export { default as refractorPluginReplaceEmptyElement } from './refractor/plugins/replace-empty-element.ts';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
default as refract,
|
|
10
|
+
refractJSONSchema,
|
|
11
|
+
refractLinkDescription,
|
|
12
|
+
} from './refractor/index.ts';
|
|
13
|
+
export type { RefractorOptions, RefractorPlugin } from './refractor/index.ts';
|
|
14
|
+
export type { Toolbox } from './refractor/toolbox.ts';
|
|
15
|
+
export { default as specificationObj } from './refractor/specification.ts';
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
isBooleanJSONSchemaElement,
|
|
19
|
+
isJSONReferenceElement,
|
|
20
|
+
isJSONSchemaElement,
|
|
21
|
+
isLinkDescriptionElement,
|
|
22
|
+
} from './predicates.ts';
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
isJSONReferenceLikeElement,
|
|
26
|
+
SpecificationVisitor,
|
|
27
|
+
FallbackVisitor,
|
|
28
|
+
FixedFieldsVisitor,
|
|
29
|
+
PatternedFieldsVisitor,
|
|
30
|
+
MapVisitor,
|
|
31
|
+
AlternatingVisitor,
|
|
32
|
+
ParentSchemaAwareVisitor,
|
|
33
|
+
Visitor,
|
|
34
|
+
} from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
35
|
+
export type {
|
|
36
|
+
SpecificationVisitorOptions,
|
|
37
|
+
FallbackVisitorOptions,
|
|
38
|
+
FixedFieldsVisitorOptions,
|
|
39
|
+
PatternedFieldsVisitorOptions,
|
|
40
|
+
MapVisitorOptions,
|
|
41
|
+
AlternatingVisitorOptions,
|
|
42
|
+
ParentSchemaAwareVisitorOptions,
|
|
43
|
+
VisitorOptions,
|
|
44
|
+
AllOfVisitor,
|
|
45
|
+
AllOfVisitorOptions,
|
|
46
|
+
AnyOfVisitor,
|
|
47
|
+
AnyOfVisitorOptions,
|
|
48
|
+
DefinitionsVisitor,
|
|
49
|
+
DefinitionsVisitorOptions,
|
|
50
|
+
DependenciesVisitor,
|
|
51
|
+
DependenciesVisitorOptions,
|
|
52
|
+
ItemsVisitorOptions,
|
|
53
|
+
OneOfVisitor,
|
|
54
|
+
OneOfVisitorOptions,
|
|
55
|
+
PatternPropertiesVisitor,
|
|
56
|
+
PatternPropertiesVisitorOptions,
|
|
57
|
+
PropertiesVisitor,
|
|
58
|
+
PropertiesVisitorOptions,
|
|
59
|
+
SchemaOrReferenceVisitor,
|
|
60
|
+
SchemaOrReferenceVisitorOptions,
|
|
61
|
+
SpecPath,
|
|
62
|
+
JSONSchemaDraft4ItemsVisitor,
|
|
63
|
+
} from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
64
|
+
|
|
65
|
+
export { default as JSONSchemaVisitor } from './refractor/visitors/json-schema/index.ts';
|
|
66
|
+
export type { JSONSchemaVisitorOptions } from './refractor/visitors/json-schema/index.ts';
|
|
67
|
+
|
|
68
|
+
export { default as LinkDescriptionVisitor } from './refractor/visitors/json-schema/link-description/index.ts';
|
|
69
|
+
export type { LinkDescriptionVisitorOptions } from './refractor/visitors/json-schema/link-description/index.ts';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* JSON Schema Draft 7 specification elements.
|
|
73
|
+
*/
|
|
74
|
+
export {
|
|
75
|
+
JSONSchemaElement,
|
|
76
|
+
JSONReferenceElement,
|
|
77
|
+
LinkDescriptionElement,
|
|
78
|
+
} from './refractor/inspect.ts';
|
|
79
|
+
export type { FixedField } from './refractor/inspect.ts';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.JSONSchemaDraft7MediaTypes = void 0;
|
|
5
|
+
var _ramda = require("ramda");
|
|
6
|
+
var _apidomCore = require("@speclynx/apidom-core");
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
class JSONSchemaDraft7MediaTypes extends _apidomCore.MediaTypes {
|
|
15
|
+
filterByFormat(format = 'generic') {
|
|
16
|
+
const effectiveFormat = format === 'generic' ? 'schema;version' : format;
|
|
17
|
+
return this.filter(mediaType => mediaType.includes(effectiveFormat));
|
|
18
|
+
}
|
|
19
|
+
findBy(version = 'draft-07', format = 'generic') {
|
|
20
|
+
const search = format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
|
|
21
|
+
const found = this.find(mediaType => mediaType.includes(search));
|
|
22
|
+
return found || this.unknownMediaType;
|
|
23
|
+
}
|
|
24
|
+
latest(format = 'generic') {
|
|
25
|
+
return (0, _ramda.last)(this.filterByFormat(format));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
exports.JSONSchemaDraft7MediaTypes = JSONSchemaDraft7MediaTypes;
|
|
33
|
+
const mediaTypes = new JSONSchemaDraft7MediaTypes('application/schema;version=draft-07', 'application/schema+json;version=draft-07', 'application/schema+yaml;version=draft-07');
|
|
34
|
+
var _default = exports.default = mediaTypes;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { last } from 'ramda';
|
|
2
|
+
import { MediaTypes } from '@speclynx/apidom-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export class JSONSchemaDraft7MediaTypes extends MediaTypes {
|
|
12
|
+
filterByFormat(format = 'generic') {
|
|
13
|
+
const effectiveFormat = format === 'generic' ? 'schema;version' : format;
|
|
14
|
+
return this.filter(mediaType => mediaType.includes(effectiveFormat));
|
|
15
|
+
}
|
|
16
|
+
findBy(version = 'draft-07', format = 'generic') {
|
|
17
|
+
const search = format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
|
|
18
|
+
const found = this.find(mediaType => mediaType.includes(search));
|
|
19
|
+
return found || this.unknownMediaType;
|
|
20
|
+
}
|
|
21
|
+
latest(format = 'generic') {
|
|
22
|
+
return last(this.filterByFormat(format));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
const mediaTypes = new JSONSchemaDraft7MediaTypes('application/schema;version=draft-07', 'application/schema+json;version=draft-07', 'application/schema+yaml;version=draft-07');
|
|
30
|
+
export default mediaTypes;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { last } from 'ramda';
|
|
2
|
+
import { MediaTypes } from '@speclynx/apidom-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type Format = 'generic' | 'json' | 'yaml';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export class JSONSchemaDraft7MediaTypes extends MediaTypes<string> {
|
|
13
|
+
filterByFormat(format: Format = 'generic') {
|
|
14
|
+
const effectiveFormat = format === 'generic' ? 'schema;version' : format;
|
|
15
|
+
return this.filter((mediaType) => mediaType.includes(effectiveFormat));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
findBy(version = 'draft-07', format: Format = 'generic') {
|
|
19
|
+
const search =
|
|
20
|
+
format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
|
|
21
|
+
const found = this.find((mediaType) => mediaType.includes(search));
|
|
22
|
+
|
|
23
|
+
return found || this.unknownMediaType;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
latest(format: Format = 'generic') {
|
|
27
|
+
return last(this.filterByFormat(format)) as string;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
const mediaTypes = new JSONSchemaDraft7MediaTypes(
|
|
35
|
+
'application/schema;version=draft-07',
|
|
36
|
+
'application/schema+json;version=draft-07',
|
|
37
|
+
'application/schema+yaml;version=draft-07',
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export default mediaTypes;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-6");
|
|
7
|
+
var _JSONSchema = _interopRequireDefault(require("./elements/JSONSchema.cjs"));
|
|
8
|
+
var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescription.cjs"));
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
const jsonSchemaDraft7 = {
|
|
13
|
+
namespace: options => {
|
|
14
|
+
const {
|
|
15
|
+
base
|
|
16
|
+
} = options;
|
|
17
|
+
base.register('jSONSchemaDraft7', _JSONSchema.default);
|
|
18
|
+
base.register('jSONReference', _apidomNsJsonSchemaDraft.JSONReferenceElement);
|
|
19
|
+
base.register('linkDescription', _LinkDescription.default);
|
|
20
|
+
return base;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var _default = exports.default = jsonSchemaDraft7;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSONReferenceElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
2
|
+
import JSONSchemaElement from "./elements/JSONSchema.mjs";
|
|
3
|
+
import LinkDescriptionElement from "./elements/LinkDescription.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
const jsonSchemaDraft7 = {
|
|
8
|
+
namespace: options => {
|
|
9
|
+
const {
|
|
10
|
+
base
|
|
11
|
+
} = options;
|
|
12
|
+
base.register('jSONSchemaDraft7', JSONSchemaElement);
|
|
13
|
+
base.register('jSONReference', JSONReferenceElement);
|
|
14
|
+
base.register('linkDescription', LinkDescriptionElement);
|
|
15
|
+
return base;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default jsonSchemaDraft7;
|
package/src/namespace.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NamespacePlugin } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { JSONReferenceElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
3
|
+
|
|
4
|
+
import JSONSchemaElement from './elements/JSONSchema.ts';
|
|
5
|
+
import LinkDescriptionElement from './elements/LinkDescription.ts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
const jsonSchemaDraft7: NamespacePlugin = {
|
|
11
|
+
namespace: (options) => {
|
|
12
|
+
const { base } = options;
|
|
13
|
+
|
|
14
|
+
base.register('jSONSchemaDraft7', JSONSchemaElement);
|
|
15
|
+
base.register('jSONReference', JSONReferenceElement);
|
|
16
|
+
base.register('linkDescription', LinkDescriptionElement);
|
|
17
|
+
|
|
18
|
+
return base;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default jsonSchemaDraft7;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.isMediaElement = exports.isLinkDescriptionElement = exports.isJSONSchemaElement = exports.isJSONReferenceElement = exports.isBooleanJSONSchemaElement = void 0;
|
|
6
|
+
var _JSONSchema = _interopRequireDefault(require("./elements/JSONSchema.cjs"));
|
|
7
|
+
var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescription.cjs"));
|
|
8
|
+
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-6");
|
|
9
|
+
exports.isJSONReferenceElement = _apidomNsJsonSchemaDraft.isJSONReferenceElement;
|
|
10
|
+
exports.isMediaElement = _apidomNsJsonSchemaDraft.isMediaElement;
|
|
11
|
+
exports.isBooleanJSONSchemaElement = _apidomNsJsonSchemaDraft.isBooleanJSONSchemaElement;
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
const isJSONSchemaElement = element => element instanceof _JSONSchema.default;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
exports.isJSONSchemaElement = isJSONSchemaElement;
|
|
21
|
+
const isLinkDescriptionElement = element => element instanceof _LinkDescription.default;
|
|
22
|
+
exports.isLinkDescriptionElement = isLinkDescriptionElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import JSONSchemaElement from "./elements/JSONSchema.mjs";
|
|
2
|
+
import LinkDescriptionElement from "./elements/LinkDescription.mjs";
|
|
3
|
+
export { isJSONReferenceElement, isMediaElement, isBooleanJSONSchemaElement } from '@speclynx/apidom-ns-json-schema-draft-6';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export const isJSONSchemaElement = element => element instanceof JSONSchemaElement;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export const isLinkDescriptionElement = element => element instanceof LinkDescriptionElement;
|