Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit c688d11

Browse files
committed
feat(oas3): remove unsupported warning for OpenAPI 3.1
1 parent f4d25cd commit c688d11

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

packages/openapi3-parser/lib/parser/openapi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { isString } = require('../predicates');
44

55
const semanticVersionRE = /^(\d+)\.(\d+).(\d+)$/;
66

7-
const supportedMinorVersion = 0;
7+
const supportedMinorVersion = 1;
88
const supportedMajorVersion = 3;
99

1010
// Parse the OpenAPI Version member

packages/openapi3-parser/test/unit/parser/oas/parseOpenAPIObject-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe('#parseOpenAPIObject', () => {
252252

253253
const parseResult = parse(context, object);
254254

255-
expect(parseResult.warnings.get(1).toValue()).to.equal("'OpenAPI Object' contains unsupported key 'webhooks'");
255+
expect(parseResult).to.contain.warning("'OpenAPI Object' contains unsupported key 'webhooks'");
256256
});
257257

258258
it('provides warning for invalid key jsonSchemaDialect in OpenAPI 3.0', () => {
@@ -284,7 +284,7 @@ describe('#parseOpenAPIObject', () => {
284284

285285
const parseResult = parse(context, object);
286286

287-
expect(parseResult.warnings.get(1).toValue()).to.equal("'OpenAPI Object' contains unsupported key 'jsonSchemaDialect'");
287+
expect(parseResult).to.contain.warning("'OpenAPI Object' contains unsupported key 'jsonSchemaDialect'");
288288
});
289289

290290
it('provides warning for invalid key webhooks in OpenAPI 3.0', () => {

packages/openapi3-parser/test/unit/parser/openapi-test.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ describe('#parseOpenAPI', () => {
4646
expect(parseResult.get(0).value.toValue()).to.equal('3.0.0');
4747
});
4848

49+
it('allows openapi 3.1.0', () => {
50+
const openapi = new namespace.elements.Member('openapi', '3.1.0');
51+
52+
const parseResult = parseOpenAPI(context, openapi);
53+
expect(parseResult).to.be.instanceof(namespace.elements.ParseResult);
54+
expect(parseResult).to.not.contain.annotations;
55+
expect(parseResult.get(0).value.toValue()).to.equal('3.1.0');
56+
});
57+
4958
it('allows openapi patch version 3.0.11', () => {
5059
const openapi = new namespace.elements.Member('openapi', '3.0.11');
5160

@@ -56,12 +65,12 @@ describe('#parseOpenAPI', () => {
5665
});
5766

5867
it('warns for unsuported minor versions', () => {
59-
const openapi = new namespace.elements.Member('openapi', '3.1.0');
68+
const openapi = new namespace.elements.Member('openapi', '3.2.0');
6069

6170
const parseResult = parseOpenAPI(context, openapi);
6271
expect(parseResult).to.be.instanceof(namespace.elements.ParseResult);
63-
expect(parseResult).to.contain.warning("Version '3.1.0' is not fully supported");
64-
expect(parseResult.get(0).value.toValue()).to.equal('3.1.0');
72+
expect(parseResult).to.contain.warning("Version '3.2.0' is not fully supported");
73+
expect(parseResult.get(0).value.toValue()).to.equal('3.2.0');
6574
});
6675

6776
it('adds the version to context', () => {

0 commit comments

Comments
 (0)