Skip to content

Commit 75e0a15

Browse files
mdrafi28jdesrosiers
authored andcommitted
update OpenApi 3.2 schemas
1 parent e236f70 commit 75e0a15

File tree

10 files changed

+53
-56
lines changed

10 files changed

+53
-56
lines changed

openapi-3-1/index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Json } from "@hyperjump/json-pointer";
22
import type { JsonSchemaType } from "../lib/common.js";
33

4-
54
export type OasSchema31 = boolean | {
65
$schema?: "https://spec.openapis.org/oas/3.1/dialect/base";
76
$id?: string;
@@ -312,4 +311,4 @@ type Examples = {
312311
examples?: Record<string, Example | Reference>;
313312
};
314313

315-
export * from "../lib/index.js";
314+
export * from "../lib/index.js";

openapi-3-1/json-schema-test-suite.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const runTestSuite = (draft: string, dialectId: string) => {
100100
} else {
101101
it(test.description, () => {
102102
const output = _validate(test.data);
103-
expect(output.valid).toBe(test.valid);
103+
expect(output.valid).to.equal(test.valid);
104104
});
105105
}
106106
});

openapi-3-2/index.d.ts

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Json } from "@hyperjump/json-pointer";
22
import type { JsonSchemaType } from "../lib/common.js";
33

4-
54
export type OasSchema32 = boolean | {
65
$schema?: "https://spec.openapis.org/oas/3.2/dialect/base";
76
$id?: string;
@@ -85,8 +84,7 @@ type Xml = {
8584
wrapped?: boolean;
8685
};
8786

88-
// TODO: Fill in this type when 3.2 is published
89-
export type OpenApi32 = {
87+
export type OpenApi = {
9088
openapi: "3.2.0";
9189
info: {
9290
title: string;
@@ -103,60 +101,60 @@ export type OpenApi32 = {
103101
url?: string;
104102
};
105103
};
106-
servers?: Array<{ url: string; description?: string }>;
107-
paths?: Record<string, PathItem32>;
108-
webhooks?: Record<string, PathItem32>; // <-- NEW in 3.2
109-
components?: Components32;
110-
security?: SecurityRequirement32[];
111-
tags?: Tag32[];
112-
externalDocs?: ExternalDocs32;
104+
servers?: Server[];
105+
paths?: Record<string, PathItem>;
106+
webhooks?: Record<string, PathItem>;
107+
components?: Components;
108+
security?: SecurityRequirement[];
109+
tags?: Tag[];
110+
externalDocs?: ExternalDocs;
113111
};
114112

115-
export type PathItem32 = {
113+
export type PathItem = {
116114
summary?: string;
117115
description?: string;
118-
get?: Operation32;
119-
put?: Operation32;
120-
post?: Operation32;
121-
delete?: Operation32;
122-
options?: Operation32;
123-
head?: Operation32;
124-
patch?: Operation32;
125-
trace?: Operation32;
126-
servers?: Array<{ url: string; description?: string }>;
127-
parameters?: Parameter32[];
116+
get?: Operation;
117+
put?: Operation;
118+
post?: Operation;
119+
delete?: Operation;
120+
options?: Operation;
121+
head?: Operation;
122+
patch?: Operation;
123+
trace?: Operation;
124+
servers?: Server[];
125+
parameters?: Parameter[];
128126
};
129127

130-
export type Operation32 = {
128+
export type Operation = {
131129
tags?: string[];
132130
summary?: string;
133131
description?: string;
134-
externalDocs?: ExternalDocs32;
132+
externalDocs?: ExternalDocs;
135133
operationId?: string;
136-
parameters?: Parameter32[];
137-
requestBody?: RequestBody32;
138-
responses: Record<string, Response32>;
139-
callbacks?: Record<string, Callback32>;
134+
parameters?: Parameter[];
135+
requestBody?: RequestBody;
136+
responses: Record<string, Response>;
137+
callbacks?: Record<string, Callback>;
140138
deprecated?: boolean;
141-
security?: SecurityRequirement32[];
142-
servers?: Array<{ url: string; description?: string }>;
139+
security?: SecurityRequirement[];
140+
servers?: Server[];
143141
};
144142

145-
export type Components32 = {
143+
export type Components = {
146144
schemas?: Record<string, OasSchema32>;
147-
responses?: Record<string, Response32>;
148-
parameters?: Record<string, Parameter32>;
149-
examples?: Record<string, Example32>;
150-
requestBodies?: Record<string, RequestBody32>;
151-
headers?: Record<string, Header32>;
152-
securitySchemes?: Record<string, SecurityScheme32>;
153-
links?: Record<string, Link32>;
154-
callbacks?: Record<string, Callback32>;
145+
responses?: Record<string, Response>;
146+
parameters?: Record<string, Parameter>;
147+
examples?: Record<string, Example>;
148+
requestBodies?: Record<string, RequestBody>;
149+
headers?: Record<string, Header>;
150+
securitySchemes?: Record<string, SecurityScheme>;
151+
links?: Record<string, Link>;
152+
callbacks?: Record<string, Callback>;
155153
};
156154

157-
export type ExternalDocs32 = {
155+
export type ExternalDocs = {
158156
description?: string;
159157
url: string;
160158
};
161159

162-
export * from "../lib/index.js";
160+
export * from "../lib/index.js";

openapi-3-2/json-schema-test-suite.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const runTestSuite = (draft: string, dialectId: string) => {
100100
} else {
101101
it(test.description, () => {
102102
const output = _validate(test.data);
103-
expect(output.valid).toBe(test.valid);
103+
expect(output.valid).to.equal(test.valid);
104104
});
105105
}
106106
});

openapi-3-2/meta/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default {
2525
"propertyName": {
2626
"type": "string"
2727
},
28-
"mappings": {
28+
"mapping": {
2929
"type": "object",
3030
"additionalProperties": {
3131
"type": "string"

openapi-3-2/schema-base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export default {
1212
"https://spec.openapis.org/oas/3.2/vocab/base": false
1313
},
1414

15-
"description": "The description of OpenAPI v3.2.x Documents using the OpenAPI JSON Schema Draft 2020-12 dialect",
15+
"description": "The description of OpenAPI v3.2.x Documents using the OpenAPI JSON Schema dialect",
1616

1717
"$ref": "https://spec.openapis.org/oas/3.2/schema",
1818
"properties": {
1919
"jsonSchemaDialect": { "$ref": "#/$defs/dialect" }
2020
},
2121

2222
"$defs": {
23-
"dialect": { "const": "https://json-schema.org/draft/2020-12/schema" },
23+
"dialect": { "const": "https://spec.openapis.org/oas/3.2/dialect/base" },
2424

2525
"schema": {
2626
"$dynamicAnchor": "meta",

openapi-3-2/schema-draft-04.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export default {
1212
"https://spec.openapis.org/oas/3.2/vocab/base": false
1313
},
1414

15-
"description": "OpenAPI v3.2.x documents using draft-2020-12 JSON Schemas",
15+
"description": "OpenAPI v3.2.x documents using draft-04 JSON Schemas",
1616

1717
"$ref": "https://spec.openapis.org/oas/3.2/schema",
1818
"properties": {
1919
"jsonSchemaDialect": { "$ref": "#/$defs/dialect" }
2020
},
2121

2222
"$defs": {
23-
"dialect": { "const": "http://json-schema.org/draft-2020-12/schema#" },
23+
"dialect": { "const": "http://json-schema.org/draft-04/schema#" },
2424

2525
"schema": {
2626
"$dynamicAnchor": "meta",

openapi-3-2/schema-draft-06.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export default {
1212
"https://spec.openapis.org/oas/3.2/vocab/base": false
1313
},
1414

15-
"description": "OpenAPI v3.2.x documents using draft-2020-12 JSON Schemas",
15+
"description": "OpenAPI v3.2.x documents using draft-06 JSON Schemas",
1616

1717
"$ref": "https://spec.openapis.org/oas/3.2/schema",
1818
"properties": {
1919
"jsonSchemaDialect": { "$ref": "#/$defs/dialect" }
2020
},
2121

2222
"$defs": {
23-
"dialect": { "const": "http://json-schema.org/draft-2020-12/schema#" },
23+
"dialect": { "const": "http://json-schema.org/draft-06/schema#" },
2424

2525
"schema": {
2626
"$dynamicAnchor": "meta",

openapi-3-2/schema-draft-07.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export default {
1212
"https://spec.openapis.org/oas/3.2/vocab/base": false
1313
},
1414

15-
"description": "OpenAPI v3.2.x documents using draft-2020-12 JSON Schemas",
15+
"description": "OpenAPI v3.2.x documents using draft-07 JSON Schemas",
1616

1717
"$ref": "https://spec.openapis.org/oas/3.2/schema",
1818
"properties": {
1919
"jsonSchemaDialect": { "$ref": "#/$defs/dialect" }
2020
},
2121

2222
"$defs": {
23-
"dialect": { "const": "http://json-schema.org/draft-2020-12/schema#" },
23+
"dialect": { "const": "http://json-schema.org/draft-07/schema#" },
2424

2525
"schema": {
2626
"$dynamicAnchor": "meta",

openapi-3-2/schema-draft-2019-09.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ export default {
1212
"https://spec.openapis.org/oas/3.2/vocab/base": false
1313
},
1414

15-
"description": "openapi v3.2.x documents using 2020-12 json schemas",
15+
"description": "openapi v3.2.x documents using 2019-09 json schemas",
1616

1717
"$ref": "https://spec.openapis.org/oas/3.2/schema",
1818
"properties": {
1919
"jsonschemadialect": { "$ref": "#/$defs/dialect" }
2020
},
2121

2222
"$defs": {
23-
"dialect": { "const": "https://json-schema.org/draft/2020-12/schema" },
23+
"dialect": { "const": "https://json-schema.org/draft/2019-09/schema" },
2424

2525
"schema": {
26-
"$dynamicanchor": "meta",
26+
"$dynamicAnchor": "meta",
2727
"$ref": "https://spec.openapis.org/oas/3.2/dialect/base",
2828
"properties": {
2929
"$schema": { "$ref": "#/$defs/dialect" }

0 commit comments

Comments
 (0)