@hyperjump/json-schema 1.16.3 → 1.16.5
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 +7 -7
- package/annotations/index.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/openapi-3-1/index.d.ts +66 -17
- package/openapi-3-1/schema-draft-2019-09.js +1 -1
- package/openapi-3-1/schema-draft-2020-12.js +1 -1
- package/openapi-3-2/dialect/base.js +2 -2
- package/openapi-3-2/index.d.ts +326 -2
- package/openapi-3-2/index.js +2 -4
- package/openapi-3-2/meta/base.js +30 -5
- package/openapi-3-2/schema-base.js +2 -3
- package/openapi-3-2/schema-draft-04.js +2 -2
- package/openapi-3-2/schema-draft-06.js +2 -2
- package/openapi-3-2/schema-draft-07.js +2 -2
- package/openapi-3-2/schema-draft-2019-09.js +3 -3
- package/openapi-3-2/schema-draft-2020-12.js +3 -3
- package/openapi-3-2/schema.js +1661 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ A collection of modules for working with JSON Schemas.
|
|
|
7
7
|
* Schemas can reference other schemas using a different dialect
|
|
8
8
|
* Work directly with schemas on the filesystem or HTTP
|
|
9
9
|
* OpenAPI
|
|
10
|
-
* Versions: 3.0, 3.1
|
|
10
|
+
* Versions: 3.0, 3.1, 3.2
|
|
11
11
|
* Validate an OpenAPI document
|
|
12
12
|
* Validate values against a schema from an OpenAPI document
|
|
13
13
|
* Create custom keywords, vocabularies, and dialects
|
|
@@ -132,22 +132,22 @@ system](https://github.com/hyperjump-io/browser/#uri-schemes) provided by
|
|
|
132
132
|
|
|
133
133
|
**OpenAPI**
|
|
134
134
|
|
|
135
|
-
The OpenAPI 3.0 and 3.1 meta-schemas are pre-loaded and the OpenAPI JSON Schema
|
|
135
|
+
The OpenAPI 3.0 and 3.1 and 3.2 meta-schemas are pre-loaded and the OpenAPI JSON Schema
|
|
136
136
|
dialects for each of those versions is supported. A document with a Content-Type
|
|
137
137
|
of `application/openapi+json` (web) or a file extension of `openapi.json`
|
|
138
138
|
(filesystem) is understood as an OpenAPI document.
|
|
139
139
|
|
|
140
140
|
Use the pattern `@hyperjump/json-schema/*` to import the version you need. The
|
|
141
|
-
available versions are `openapi-3-0` for 3.0
|
|
141
|
+
available versions are `openapi-3-0` for 3.0, `openapi-3-1` for 3.1, and `openapi-3-2` for 3.2.
|
|
142
142
|
|
|
143
143
|
```javascript
|
|
144
|
-
import { validate } from "@hyperjump/json-schema/openapi-3-
|
|
144
|
+
import { validate } from "@hyperjump/json-schema/openapi-3-2";
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
// Validate an OpenAPI document
|
|
148
|
-
const output = await validate("https://spec.openapis.org/oas/3.
|
|
147
|
+
// Validate an OpenAPI 3.2 document
|
|
148
|
+
const output = await validate("https://spec.openapis.org/oas/3.2/schema-base", openapi);
|
|
149
149
|
|
|
150
|
-
// Validate an instance against a schema in an OpenAPI document
|
|
150
|
+
// Validate an instance against a schema in an OpenAPI 3.2 document
|
|
151
151
|
const output = await validate("./example.openapi.json#/components/schemas/foo", 42);
|
|
152
152
|
```
|
|
153
153
|
|
package/annotations/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type Annotator = (value: Json, options?: OutputFormat | ValidationOptions
|
|
|
15
15
|
export const interpret: (compiledSchema: CompiledSchema, value: JsonNode, options?: OutputFormat | ValidationOptions) => JsonNode;
|
|
16
16
|
|
|
17
17
|
export class ValidationError extends Error {
|
|
18
|
-
public output: Output;
|
|
18
|
+
public output: Output & { valid: false };
|
|
19
19
|
|
|
20
20
|
public constructor(output: Output);
|
|
21
21
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export const setShouldValidateSchema: (isEnabled: boolean) => void;
|
|
|
56
56
|
export const getShouldValidateSchema: () => boolean;
|
|
57
57
|
|
|
58
58
|
export class InvalidSchemaError extends Error {
|
|
59
|
-
public output: Output;
|
|
59
|
+
public output: Output & { valid: false };
|
|
60
60
|
|
|
61
61
|
public constructor(output: Output);
|
|
62
62
|
}
|
package/openapi-3-1/index.d.ts
CHANGED
|
@@ -180,18 +180,55 @@ type ExternalDocumentation = {
|
|
|
180
180
|
url: string;
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
-
type Parameter = {
|
|
183
|
+
export type Parameter = {
|
|
184
184
|
name: string;
|
|
185
|
-
in: "query" | "header" | "path" | "cookie";
|
|
186
185
|
description?: string;
|
|
187
186
|
required?: boolean;
|
|
188
187
|
deprecated?: boolean;
|
|
189
188
|
allowEmptyValue?: boolean;
|
|
190
|
-
|
|
189
|
+
} & (
|
|
190
|
+
(
|
|
191
|
+
{
|
|
192
|
+
in: "path";
|
|
193
|
+
required: true;
|
|
194
|
+
} & (
|
|
195
|
+
({ style?: "matrix" | "label" | "simple" } & SchemaParameter)
|
|
196
|
+
| ContentParameter
|
|
197
|
+
)
|
|
198
|
+
) | (
|
|
199
|
+
{
|
|
200
|
+
in: "query";
|
|
201
|
+
} & (
|
|
202
|
+
({ style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject" } & SchemaParameter)
|
|
203
|
+
| ContentParameter
|
|
204
|
+
)
|
|
205
|
+
) | (
|
|
206
|
+
{
|
|
207
|
+
in: "header";
|
|
208
|
+
} & (
|
|
209
|
+
({ style?: "simple" } & SchemaParameter)
|
|
210
|
+
| ContentParameter
|
|
211
|
+
)
|
|
212
|
+
) | (
|
|
213
|
+
{
|
|
214
|
+
in: "cookie";
|
|
215
|
+
} & (
|
|
216
|
+
({ style?: "form" } & SchemaParameter)
|
|
217
|
+
| ContentParameter
|
|
218
|
+
)
|
|
219
|
+
)
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
type ContentParameter = {
|
|
223
|
+
schema?: never;
|
|
224
|
+
content: Record<string, MediaType | Reference>;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
type SchemaParameter = {
|
|
191
228
|
explode?: boolean;
|
|
192
229
|
allowReserved?: boolean;
|
|
193
|
-
schema
|
|
194
|
-
content?:
|
|
230
|
+
schema: OasSchema32;
|
|
231
|
+
content?: never;
|
|
195
232
|
} & Examples;
|
|
196
233
|
|
|
197
234
|
type RequestBody = {
|
|
@@ -237,7 +274,7 @@ type Link = {
|
|
|
237
274
|
parameters?: Record<string, string>;
|
|
238
275
|
requestBody?: Json;
|
|
239
276
|
description?: string;
|
|
240
|
-
|
|
277
|
+
server?: Server;
|
|
241
278
|
};
|
|
242
279
|
|
|
243
280
|
type Header = {
|
|
@@ -259,25 +296,37 @@ type Tag = {
|
|
|
259
296
|
type Reference = {
|
|
260
297
|
$ref: string;
|
|
261
298
|
summary?: string;
|
|
262
|
-
|
|
299
|
+
description?: string;
|
|
263
300
|
};
|
|
264
301
|
|
|
265
302
|
type SecurityScheme = {
|
|
266
|
-
type: "apiKey"
|
|
303
|
+
type: "apiKey";
|
|
267
304
|
description?: string;
|
|
268
|
-
name
|
|
269
|
-
in
|
|
270
|
-
|
|
305
|
+
name: string;
|
|
306
|
+
in: "query" | "header" | "cookie";
|
|
307
|
+
} | {
|
|
308
|
+
type: "http";
|
|
309
|
+
description?: string;
|
|
310
|
+
scheme: string;
|
|
271
311
|
bearerFormat?: string;
|
|
272
|
-
|
|
273
|
-
|
|
312
|
+
} | {
|
|
313
|
+
type: "mutualTLS";
|
|
314
|
+
description?: string;
|
|
315
|
+
} | {
|
|
316
|
+
type: "oauth2";
|
|
317
|
+
description?: string;
|
|
318
|
+
flows: OauthFlows;
|
|
319
|
+
} | {
|
|
320
|
+
type: "openIdConnect";
|
|
321
|
+
description?: string;
|
|
322
|
+
openIdConnectUrl: string;
|
|
274
323
|
};
|
|
275
324
|
|
|
276
325
|
type OauthFlows = {
|
|
277
|
-
implicit
|
|
278
|
-
|
|
279
|
-
clientCredentials
|
|
280
|
-
authorizationCode
|
|
326
|
+
implicit?: Implicit;
|
|
327
|
+
password?: Password;
|
|
328
|
+
clientCredentials?: ClientCredentials;
|
|
329
|
+
authorizationCode?: AuthorizationCode;
|
|
281
330
|
};
|
|
282
331
|
|
|
283
332
|
type Implicit = {
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
"dialect": { "const": "https://json-schema.org/draft/2019-09/schema" },
|
|
24
24
|
|
|
25
25
|
"schema": {
|
|
26
|
-
"$
|
|
26
|
+
"$dynamicAnchor": "meta",
|
|
27
27
|
"$ref": "https://spec.openapis.org/oas/3.1/dialect/base",
|
|
28
28
|
"properties": {
|
|
29
29
|
"$schema": { "$ref": "#/$defs/dialect" }
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
"dialect": { "const": "https://json-schema.org/draft/2020-12/schema" },
|
|
24
24
|
|
|
25
25
|
"schema": {
|
|
26
|
-
"$
|
|
26
|
+
"$dynamicAnchor": "meta",
|
|
27
27
|
"$ref": "https://spec.openapis.org/oas/3.1/dialect/base",
|
|
28
28
|
"properties": {
|
|
29
29
|
"$schema": { "$ref": "#/$defs/dialect" }
|
|
@@ -13,10 +13,10 @@ export default {
|
|
|
13
13
|
"$dynamicAnchor": "meta",
|
|
14
14
|
|
|
15
15
|
"title": "OpenAPI 3.2 Schema Object Dialect",
|
|
16
|
-
"description": "A JSON Schema dialect describing schemas found in OpenAPI v3.2 Descriptions",
|
|
16
|
+
"description": "A JSON Schema dialect describing schemas found in OpenAPI v3.2.x Descriptions",
|
|
17
17
|
|
|
18
18
|
"allOf": [
|
|
19
19
|
{ "$ref": "https://json-schema.org/draft/2020-12/schema" },
|
|
20
|
-
{ "$ref": "https://spec.openapis.org/oas/3.2/meta
|
|
20
|
+
{ "$ref": "https://spec.openapis.org/oas/3.2/meta" }
|
|
21
21
|
]
|
|
22
22
|
};
|
package/openapi-3-2/index.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export type OasSchema32 = boolean | {
|
|
|
70
70
|
type Discriminator = {
|
|
71
71
|
propertyName: string;
|
|
72
72
|
mappings?: Record<string, string>;
|
|
73
|
+
defaultMapping?: string;
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
type ExternalDocs = {
|
|
@@ -78,6 +79,7 @@ type ExternalDocs = {
|
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
type Xml = {
|
|
82
|
+
nodeType?: "element" | "attribute" | "text" | "cdata" | "none";
|
|
81
83
|
name?: string;
|
|
82
84
|
namespace?: string;
|
|
83
85
|
prefix?: string;
|
|
@@ -85,7 +87,329 @@ type Xml = {
|
|
|
85
87
|
wrapped?: boolean;
|
|
86
88
|
};
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
export type OpenApi = {
|
|
91
|
+
openapi: string;
|
|
92
|
+
$self?: string;
|
|
93
|
+
info: Info;
|
|
94
|
+
jsonSchemaDialect?: string;
|
|
95
|
+
servers?: Server[];
|
|
96
|
+
paths?: Record<string, PathItem>;
|
|
97
|
+
webhooks?: Record<string, PathItem>;
|
|
98
|
+
components?: Components;
|
|
99
|
+
security?: SecurityRequirement[];
|
|
100
|
+
tags?: Tag[];
|
|
101
|
+
externalDocs?: ExternalDocs;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type Info = {
|
|
105
|
+
title: string;
|
|
106
|
+
summary?: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
termsOfService?: string;
|
|
109
|
+
contact?: Contact;
|
|
110
|
+
license?: License;
|
|
111
|
+
version: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
type Contact = {
|
|
115
|
+
name?: string;
|
|
116
|
+
url?: string;
|
|
117
|
+
email?: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
type License = {
|
|
121
|
+
name: string;
|
|
122
|
+
identifier?: string;
|
|
123
|
+
url?: string;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
type Server = {
|
|
127
|
+
url: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
name?: string;
|
|
130
|
+
variables?: Record<string, ServerVariable>;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
type ServerVariable = {
|
|
134
|
+
enum?: string[];
|
|
135
|
+
default: string;
|
|
136
|
+
description?: string;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
type Components = {
|
|
140
|
+
schemas?: Record<string, OasSchema32>;
|
|
141
|
+
responses?: Record<string, Response | Reference>;
|
|
142
|
+
parameters?: Record<string, Parameter | Reference>;
|
|
143
|
+
examples?: Record<string, Example | Reference>;
|
|
144
|
+
requestBodies?: Record<string, RequestBody | Reference>;
|
|
145
|
+
headers?: Record<string, Header | Reference>;
|
|
146
|
+
securitySchemes?: Record<string, SecurityScheme | Reference>;
|
|
147
|
+
links?: Record<string, Link | Reference>;
|
|
148
|
+
callbacks?: Record<string, Callbacks | Reference>;
|
|
149
|
+
pathItems?: Record<string, PathItem>;
|
|
150
|
+
mediaTypes?: Record<string, MediaType | Reference>;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
type PathItem = {
|
|
154
|
+
$ref?: string;
|
|
155
|
+
summary?: string;
|
|
156
|
+
description?: string;
|
|
157
|
+
get?: Operation;
|
|
158
|
+
put?: Operation;
|
|
159
|
+
post?: Operation;
|
|
160
|
+
delete?: Operation;
|
|
161
|
+
options?: Operation;
|
|
162
|
+
head?: Operation;
|
|
163
|
+
patch?: Operation;
|
|
164
|
+
trace?: Operation;
|
|
165
|
+
query?: Operation;
|
|
166
|
+
additionOperations?: Record<string, Operation>;
|
|
167
|
+
servers?: Server[];
|
|
168
|
+
parameters?: (Parameter | Reference)[];
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
type Operation = {
|
|
172
|
+
tags?: string[];
|
|
173
|
+
summary?: string;
|
|
174
|
+
description?: string;
|
|
175
|
+
externalDocs?: ExternalDocs;
|
|
176
|
+
operationId?: string;
|
|
177
|
+
parameters?: (Parameter | Reference)[];
|
|
178
|
+
requestBody?: RequestBody | Reference;
|
|
179
|
+
responses?: Responses;
|
|
180
|
+
callbacks?: Record<string, Callbacks | Reference>;
|
|
181
|
+
deprecated?: boolean;
|
|
182
|
+
security?: SecurityRequirement[];
|
|
183
|
+
servers?: Server[];
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export type Parameter = {
|
|
187
|
+
name: string;
|
|
188
|
+
description?: string;
|
|
189
|
+
required?: boolean;
|
|
190
|
+
deprecated?: boolean;
|
|
191
|
+
allowEmptyValue?: boolean;
|
|
192
|
+
} & Examples & (
|
|
193
|
+
(
|
|
194
|
+
{
|
|
195
|
+
in: "path";
|
|
196
|
+
required: true;
|
|
197
|
+
} & (
|
|
198
|
+
({ style?: "matrix" | "label" | "simple" } & SchemaParameter)
|
|
199
|
+
| ContentParameter
|
|
200
|
+
)
|
|
201
|
+
) | (
|
|
202
|
+
{
|
|
203
|
+
in: "query";
|
|
204
|
+
} & (
|
|
205
|
+
({ style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject" } & SchemaParameter)
|
|
206
|
+
| ContentParameter
|
|
207
|
+
)
|
|
208
|
+
) | (
|
|
209
|
+
{
|
|
210
|
+
in: "header";
|
|
211
|
+
} & (
|
|
212
|
+
({ style?: "simple" } & SchemaParameter)
|
|
213
|
+
| ContentParameter
|
|
214
|
+
)
|
|
215
|
+
) | (
|
|
216
|
+
{
|
|
217
|
+
in: "cookie";
|
|
218
|
+
} & (
|
|
219
|
+
({ style?: "cookie" } & SchemaParameter)
|
|
220
|
+
| ContentParameter
|
|
221
|
+
)
|
|
222
|
+
) | (
|
|
223
|
+
{ in: "querystring" } & ContentParameter
|
|
224
|
+
)
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
type ContentParameter = {
|
|
228
|
+
schema?: never;
|
|
229
|
+
content: Record<string, MediaType | Reference>;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
type SchemaParameter = {
|
|
233
|
+
explode?: boolean;
|
|
234
|
+
allowReserved?: boolean;
|
|
235
|
+
schema: OasSchema32;
|
|
236
|
+
content?: never;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
type RequestBody = {
|
|
240
|
+
description?: string;
|
|
241
|
+
content: Record<string, MediaType | Reference>;
|
|
242
|
+
required?: boolean;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
type MediaType = {
|
|
246
|
+
schema?: OasSchema32;
|
|
247
|
+
itemSchema?: OasSchema32;
|
|
248
|
+
} & Examples & ({
|
|
249
|
+
encoding?: Record<string, Encoding>;
|
|
250
|
+
prefixEncoding?: never;
|
|
251
|
+
itemEncoding?: never;
|
|
252
|
+
} | {
|
|
253
|
+
encoding?: never;
|
|
254
|
+
prefixEncoding?: Encoding[];
|
|
255
|
+
itemEncoding?: Encoding;
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
type Encoding = {
|
|
259
|
+
contentType?: string;
|
|
260
|
+
headers?: Record<string, Header | Reference>;
|
|
261
|
+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
|
|
262
|
+
explode?: boolean;
|
|
263
|
+
allowReserved?: boolean;
|
|
264
|
+
} & ({
|
|
265
|
+
encoding?: Record<string, Encoding>;
|
|
266
|
+
prefixEncoding?: never;
|
|
267
|
+
itemEncoding?: never;
|
|
268
|
+
} | {
|
|
269
|
+
encoding?: never;
|
|
270
|
+
prefixEncoding?: Encoding[];
|
|
271
|
+
itemEncoding?: Encoding;
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
type Responses = {
|
|
275
|
+
default?: Response | Reference;
|
|
276
|
+
} & Record<string, Response | Reference>;
|
|
277
|
+
|
|
278
|
+
type Response = {
|
|
279
|
+
summary?: string;
|
|
280
|
+
description?: string;
|
|
281
|
+
headers?: Record<string, Header | Reference>;
|
|
282
|
+
content?: Record<string, MediaType | Reference>;
|
|
283
|
+
links?: Record<string, Link | Reference>;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
type Callbacks = Record<string, PathItem | Reference>;
|
|
287
|
+
|
|
288
|
+
type Examples = {
|
|
289
|
+
example?: Json;
|
|
290
|
+
examples?: Record<string, Example | Reference>;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
type Example = {
|
|
294
|
+
summary?: string;
|
|
295
|
+
description?: string;
|
|
296
|
+
} & ({
|
|
297
|
+
value?: Json;
|
|
298
|
+
dataValue?: never;
|
|
299
|
+
serializedValue?: never;
|
|
300
|
+
externalValue?: never;
|
|
301
|
+
} | {
|
|
302
|
+
value?: never;
|
|
303
|
+
dataValue?: Json;
|
|
304
|
+
serializedValue?: string;
|
|
305
|
+
externalValue?: string;
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
type Link = {
|
|
309
|
+
operationRef?: string;
|
|
310
|
+
operationId?: string;
|
|
311
|
+
parameters?: Record<string, string>;
|
|
312
|
+
requestBody?: Json;
|
|
313
|
+
description?: string;
|
|
314
|
+
server?: Server;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
type Header = {
|
|
318
|
+
description?: string;
|
|
319
|
+
required?: boolean;
|
|
320
|
+
deprecated?: boolean;
|
|
321
|
+
} & Examples & ({
|
|
322
|
+
style?: "simple";
|
|
323
|
+
explode?: boolean;
|
|
324
|
+
schema: OasSchema32;
|
|
325
|
+
} | {
|
|
326
|
+
content: Record<string, MediaType | Reference>;
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
type Tag = {
|
|
330
|
+
name: string;
|
|
331
|
+
summary?: string;
|
|
332
|
+
description?: string;
|
|
333
|
+
externalDocs?: ExternalDocs;
|
|
334
|
+
parent?: string;
|
|
335
|
+
kind?: string;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
type Reference = {
|
|
339
|
+
$ref: string;
|
|
340
|
+
summary?: string;
|
|
341
|
+
description?: string;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
type SecurityScheme = {
|
|
345
|
+
type: "apiKey";
|
|
346
|
+
description?: string;
|
|
347
|
+
name: string;
|
|
348
|
+
in: "query" | "header" | "cookie";
|
|
349
|
+
deprecated?: boolean;
|
|
350
|
+
} | {
|
|
351
|
+
type: "http";
|
|
352
|
+
description?: string;
|
|
353
|
+
scheme: string;
|
|
354
|
+
bearerFormat?: string;
|
|
355
|
+
deprecated?: boolean;
|
|
356
|
+
} | {
|
|
357
|
+
type: "mutualTLS";
|
|
358
|
+
description?: string;
|
|
359
|
+
deprecated?: boolean;
|
|
360
|
+
} | {
|
|
361
|
+
type: "oauth2";
|
|
362
|
+
description?: string;
|
|
363
|
+
flows: OauthFlows;
|
|
364
|
+
oauth2MetadataUrl?: string;
|
|
365
|
+
deprecated?: boolean;
|
|
366
|
+
} | {
|
|
367
|
+
type: "openIdConnect";
|
|
368
|
+
description?: string;
|
|
369
|
+
openIdConnectUrl: string;
|
|
370
|
+
deprecated?: boolean;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
type OauthFlows = {
|
|
374
|
+
implicit?: Implicit;
|
|
375
|
+
password?: Password;
|
|
376
|
+
clientCredentials?: ClientCredentials;
|
|
377
|
+
authorizationCode?: AuthorizationCode;
|
|
378
|
+
deviceAuthorization?: DeviceAuthorization;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
type Implicit = {
|
|
382
|
+
authorizationUrl: string;
|
|
383
|
+
refreshUrl?: string;
|
|
384
|
+
scopes: Record<string, string>;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
type Password = {
|
|
388
|
+
tokenUrl: string;
|
|
389
|
+
refreshUrl?: string;
|
|
390
|
+
scopes: Record<string, string>;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
type ClientCredentials = {
|
|
394
|
+
tokenUrl: string;
|
|
395
|
+
refreshUrl?: string;
|
|
396
|
+
scopes: Record<string, string>;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
type AuthorizationCode = {
|
|
400
|
+
authorizationUrl: string;
|
|
401
|
+
tokenUrl: string;
|
|
402
|
+
refreshUrl?: string;
|
|
403
|
+
scopes: Record<string, string>;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
type DeviceAuthorization = {
|
|
407
|
+
deviceAuthorizationUrl: string;
|
|
408
|
+
tokenUrl: string;
|
|
409
|
+
refreshUrl?: string;
|
|
410
|
+
scopes: Record<string, string>;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
type SecurityRequirement = Record<string, string[]>;
|
|
90
414
|
|
|
91
415
|
export * from "../lib/index.js";
|
package/openapi-3-2/index.js
CHANGED
|
@@ -32,14 +32,12 @@ defineVocabulary("https://spec.openapis.org/oas/3.2/vocab/base", {
|
|
|
32
32
|
"xml": "https://spec.openapis.org/oas/3.0/keyword/xml"
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
registerSchema(vocabularySchema, "https://spec.openapis.org/oas/3.2/meta
|
|
36
|
-
registerSchema(dialectSchema, "https://spec.openapis.org/oas/3.2/dialect
|
|
35
|
+
registerSchema(vocabularySchema, "https://spec.openapis.org/oas/3.2/meta");
|
|
36
|
+
registerSchema(dialectSchema, "https://spec.openapis.org/oas/3.2/dialect");
|
|
37
37
|
|
|
38
38
|
// Current Schemas
|
|
39
39
|
registerSchema(schema, "https://spec.openapis.org/oas/3.2/schema");
|
|
40
|
-
registerSchema(schema, "https://spec.openapis.org/oas/3.2/schema/latest");
|
|
41
40
|
registerSchema(schemaBase, "https://spec.openapis.org/oas/3.2/schema-base");
|
|
42
|
-
registerSchema(schemaBase, "https://spec.openapis.org/oas/3.2/schema-base/latest");
|
|
43
41
|
|
|
44
42
|
// Alternative dialect schemas
|
|
45
43
|
registerSchema(schemaDraft2020, "https://spec.openapis.org/oas/3.2/schema-draft-2020-12");
|
package/openapi-3-2/meta/base.js
CHANGED
|
@@ -3,21 +3,23 @@ export default {
|
|
|
3
3
|
"$dynamicAnchor": "meta",
|
|
4
4
|
|
|
5
5
|
"title": "OAS Base Vocabulary",
|
|
6
|
-
"description": "A JSON Schema Vocabulary used in the OpenAPI Schema Dialect",
|
|
6
|
+
"description": "A JSON Schema Vocabulary used in the OpenAPI JSON Schema Dialect",
|
|
7
7
|
|
|
8
8
|
"type": ["object", "boolean"],
|
|
9
9
|
"properties": {
|
|
10
|
-
"example": true,
|
|
11
10
|
"discriminator": { "$ref": "#/$defs/discriminator" },
|
|
11
|
+
"example": { "deprecated": true },
|
|
12
12
|
"externalDocs": { "$ref": "#/$defs/external-docs" },
|
|
13
13
|
"xml": { "$ref": "#/$defs/xml" }
|
|
14
14
|
},
|
|
15
|
+
|
|
15
16
|
"$defs": {
|
|
16
17
|
"extensible": {
|
|
17
18
|
"patternProperties": {
|
|
18
19
|
"^x-": true
|
|
19
20
|
}
|
|
20
21
|
},
|
|
22
|
+
|
|
21
23
|
"discriminator": {
|
|
22
24
|
"$ref": "#/$defs/extensible",
|
|
23
25
|
"type": "object",
|
|
@@ -30,6 +32,9 @@ export default {
|
|
|
30
32
|
"additionalProperties": {
|
|
31
33
|
"type": "string"
|
|
32
34
|
}
|
|
35
|
+
},
|
|
36
|
+
"defaultMapping": {
|
|
37
|
+
"type": "string"
|
|
33
38
|
}
|
|
34
39
|
},
|
|
35
40
|
"required": ["propertyName"],
|
|
@@ -54,21 +59,41 @@ export default {
|
|
|
54
59
|
"$ref": "#/$defs/extensible",
|
|
55
60
|
"type": "object",
|
|
56
61
|
"properties": {
|
|
62
|
+
"nodeType": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"enum": [
|
|
65
|
+
"element",
|
|
66
|
+
"attribute",
|
|
67
|
+
"text",
|
|
68
|
+
"cdata",
|
|
69
|
+
"none"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
57
72
|
"name": {
|
|
58
73
|
"type": "string"
|
|
59
74
|
},
|
|
60
75
|
"namespace": {
|
|
61
76
|
"type": "string",
|
|
62
|
-
"format": "
|
|
77
|
+
"format": "iri"
|
|
63
78
|
},
|
|
64
79
|
"prefix": {
|
|
65
80
|
"type": "string"
|
|
66
81
|
},
|
|
67
82
|
"attribute": {
|
|
68
|
-
"type": "boolean"
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"deprecated": true
|
|
69
85
|
},
|
|
70
86
|
"wrapped": {
|
|
71
|
-
"type": "boolean"
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"deprecated": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"dependentSchemas": {
|
|
92
|
+
"nodeType": {
|
|
93
|
+
"properties": {
|
|
94
|
+
"attribute": false,
|
|
95
|
+
"wrapped": false
|
|
96
|
+
}
|
|
72
97
|
}
|
|
73
98
|
},
|
|
74
99
|
"unevaluatedProperties": false
|
|
@@ -20,11 +20,10 @@ export default {
|
|
|
20
20
|
},
|
|
21
21
|
|
|
22
22
|
"$defs": {
|
|
23
|
-
"dialect": { "const": "https://spec.openapis.org/oas/3.2/dialect
|
|
24
|
-
|
|
23
|
+
"dialect": { "const": "https://spec.openapis.org/oas/3.2/dialect" },
|
|
25
24
|
"schema": {
|
|
26
25
|
"$dynamicAnchor": "meta",
|
|
27
|
-
"$ref": "https://spec.openapis.org/oas/3.2/dialect
|
|
26
|
+
"$ref": "https://spec.openapis.org/oas/3.2/dialect",
|
|
28
27
|
"properties": {
|
|
29
28
|
"$schema": { "$ref": "#/$defs/dialect" }
|
|
30
29
|
}
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
"https://spec.openapis.org/oas/3.2/vocab/base": false
|
|
13
13
|
},
|
|
14
14
|
|
|
15
|
-
"description": "OpenAPI v3.2.x
|
|
15
|
+
"description": "The description of OpenAPI v3.2.x Documents using the draft-04 JSON Schema dialect",
|
|
16
16
|
|
|
17
17
|
"$ref": "https://spec.openapis.org/oas/3.2/schema",
|
|
18
18
|
"properties": {
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
|
|
25
25
|
"schema": {
|
|
26
26
|
"$dynamicAnchor": "meta",
|
|
27
|
-
"$ref": "https://spec.openapis.org/oas/3.2/dialect
|
|
27
|
+
"$ref": "https://spec.openapis.org/oas/3.2/dialect",
|
|
28
28
|
"properties": {
|
|
29
29
|
"$schema": { "$ref": "#/$defs/dialect" }
|
|
30
30
|
}
|