Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/openapi3-parser/lib/parser/openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { isString } = require('../predicates');

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

const supportedMinorVersion = 0;
const supportedMinorVersion = 1;
const supportedMajorVersion = 3;

// Parse the OpenAPI Version member
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ describe('#parseOpenAPIObject', () => {

const parseResult = parse(context, object);

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

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

const parseResult = parse(context, object);

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

it('provides warning for invalid key webhooks in OpenAPI 3.0', () => {
Expand Down
15 changes: 12 additions & 3 deletions packages/openapi3-parser/test/unit/parser/openapi-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ describe('#parseOpenAPI', () => {
expect(parseResult.get(0).value.toValue()).to.equal('3.0.0');
});

it('allows openapi 3.1.0', () => {
const openapi = new namespace.elements.Member('openapi', '3.1.0');

const parseResult = parseOpenAPI(context, openapi);
expect(parseResult).to.be.instanceof(namespace.elements.ParseResult);
expect(parseResult).to.not.contain.annotations;
expect(parseResult.get(0).value.toValue()).to.equal('3.1.0');
});

it('allows openapi patch version 3.0.11', () => {
const openapi = new namespace.elements.Member('openapi', '3.0.11');

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

it('warns for unsuported minor versions', () => {
const openapi = new namespace.elements.Member('openapi', '3.1.0');
const openapi = new namespace.elements.Member('openapi', '3.2.0');

const parseResult = parseOpenAPI(context, openapi);
expect(parseResult).to.be.instanceof(namespace.elements.ParseResult);
expect(parseResult).to.contain.warning("Version '3.1.0' is not fully supported");
expect(parseResult.get(0).value.toValue()).to.equal('3.1.0');
expect(parseResult).to.contain.warning("Version '3.2.0' is not fully supported");
expect(parseResult.get(0).value.toValue()).to.equal('3.2.0');
});

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