Skip to content

Commit 2ffceab

Browse files
authored
Merge pull request #685 from seriousme/support-openapi-3.2
feat: add support for OpenApi 3.2
2 parents f0f30a4 + 9c743e0 commit 2ffceab

File tree

9 files changed

+33
-24
lines changed

9 files changed

+33
-24
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
## [Unreleased]
44
### Changed
55

6+
## [4.10.0] 26-09-2025
7+
### Changed
8+
- feat: add support for OpenApi 3.2
9+
- chore: updated dependencies
10+
- @seriousme/openapi-schema-validator ^2.4.4 → ^2.7.0
11+
- @biomejs/biome ^2.2.0 → ^2.2.4
12+
- fastify ^5.5.0 → ^5.6.1
13+
614
## [4.9.2] 17-08-2025
715
### Changed
816
- feat(dev): add index.d.ts tests

docs/schema2020.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ At the time of writing (April 2025) AJV uses [JSON schema draft-07 as default ve
99

1010
The OpenApi specifications until 3.1 (e.g. [3.0.4](https://spec.openapis.org/oas/v3.0.4.html#schema-object)) specify JSON schema draft-05, this works fine with AJV's draft-07.
1111

12-
The OpenApi specifications from 3.1 (e.g. [3.1.0](https://spec.openapis.org/oas/v3.1.0.html#schema-object)) specify JSON schema draft-2020-12 which works fine with AJV's draft-07 most of the time but has some new additions like `unevaluatedProperties` and even some breaking changes, see https://ajv.js.org/json-schema.html#json-schema-versions.
12+
The OpenApi specifications from 3.1 (e.g. [3.2.0](https://spec.openapis.org/oas/v3.2.0.html#schema-object)) specify JSON schema draft-2020-12 which works fine with AJV's draft-07 most of the time but has some new additions like `unevaluatedProperties` and even some breaking changes, see https://ajv.js.org/json-schema.html#json-schema-versions.
1313

1414
If you have/need these new additions in your OpenApi specification you need to tell `Fastify` to use `AJV` with `2020` schema.
1515

examples/generated-javascript-project/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
},
1414
"dependencies": {
1515
"fastify-plugin": "^5.0.1",
16-
"@seriousme/openapi-schema-validator": "^2.4.4",
16+
"@seriousme/openapi-schema-validator": "^2.7.0",
1717
"js-yaml": "^4.1.0",
18-
"fastify-openapi-glue": "^4.9.1"
18+
"fastify-openapi-glue": "^4.9.2"
1919
},
2020
"devDependencies": {
21-
"fastify": "^5.5.0",
21+
"fastify": "^5.6.1",
2222
"fastify-cli": "^7.4.0",
2323
"c8": "^10.1.3",
24-
"@biomejs/biome": "^2.2.0",
24+
"@biomejs/biome": "^2.2.4",
2525
"expect-type": "^1.2.2",
2626
"typescript": "^5.9.2"
2727
}

examples/generated-standaloneJS-project/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
},
1414
"dependencies": {
1515
"fastify-plugin": "^5.0.1",
16-
"@seriousme/openapi-schema-validator": "^2.4.4",
16+
"@seriousme/openapi-schema-validator": "^2.7.0",
1717
"js-yaml": "^4.1.0"
1818
},
1919
"devDependencies": {
20-
"fastify": "^5.5.0",
20+
"fastify": "^5.6.1",
2121
"fastify-cli": "^7.4.0",
2222
"c8": "^10.1.3",
23-
"@biomejs/biome": "^2.2.0",
23+
"@biomejs/biome": "^2.2.4",
2424
"expect-type": "^1.2.2",
2525
"typescript": "^5.9.2"
2626
}

lib/Parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ export class Parser {
4242
*/
4343

4444
async parse(specification, options = {}) {
45-
const supportedVersions = new Set(["2.0", "3.0", "3.1"]);
45+
const supportedVersions = new Set(["2.0", "3.0", "3.1", "3.2"]);
4646

4747
const res = await this.preProcessSpec(specification);
4848
if (!(res.valid && supportedVersions.has(res.version))) {
4949
throw new Error(
50-
"'specification' parameter must contain a valid version 2.0 or 3.0.x or 3.1.x specification",
50+
"'specification' parameter must contain a valid specification of a supported OpenApi version",
5151
);
5252
}
5353

package-lock.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"openapi-glue": "./bin/openapi-glue-cli.js"
2929
},
3030
"dependencies": {
31-
"@seriousme/openapi-schema-validator": "^2.4.4",
31+
"@seriousme/openapi-schema-validator": "^2.7.0",
3232
"fastify-plugin": "^5.0.1",
3333
"js-yaml": "^4.1.0"
3434
},
@@ -39,10 +39,10 @@
3939
"bin": "./bin"
4040
},
4141
"devDependencies": {
42-
"@biomejs/biome": "^2.2.0",
42+
"@biomejs/biome": "^2.2.4",
4343
"c8": "^10.1.3",
4444
"expect-type": "^1.2.2",
45-
"fastify": "^5.5.0",
45+
"fastify": "^5.6.1",
4646
"fastify-cli": "^7.4.0",
4747
"typescript": "^5.9.2"
4848
},

test/test-plugin.v2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ test("invalid openapi v2 specification throws error ", (t, done) => {
171171
if (err) {
172172
t.assert.equal(
173173
err.message,
174-
"'specification' parameter must contain a valid version 2.0 or 3.0.x or 3.1.x specification",
174+
"'specification' parameter must contain a valid specification of a supported OpenApi version",
175175
"got expected error",
176176
);
177177
done();

test/test-plugin.v3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ test("invalid openapi v3 specification throws error ", (t, done) => {
288288
if (err) {
289289
t.assert.equal(
290290
err.message,
291-
"'specification' parameter must contain a valid version 2.0 or 3.0.x or 3.1.x specification",
291+
"'specification' parameter must contain a valid specification of a supported OpenApi version",
292292
"got expected error",
293293
);
294294
done();

0 commit comments

Comments
 (0)