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

Commit 7dab229

Browse files
authored
Merge pull request #207 from apiaryio/kylef/oas3-openapi-3.1
Parsing openapi version should return version on success
2 parents c74f87e + 1e6cbdb commit 7dab229

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

packages/fury-adapter-oas3-parser/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Fury OAS3 Parser Changelog
22

3+
## Master
4+
5+
### Bug Fixes
6+
7+
- Fixes a bug where parsing an OpenAPI 3.1.0 or higher document will result in
8+
an parse result containing only a warning and missing the API Category.
9+
310
## 0.7.2 (2019-04-01)
411

512
### Bug Fixes

packages/fury-adapter-oas3-parser/lib/parser/openapi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function parseOpenAPI(context, openapi) {
2626
}
2727

2828
if (parseInt(versionInfo[2], 10) > supportedMinorVersion) {
29-
return new namespace.elements.ParseResult([createWarning(namespace, `Version '${openapi.value.toValue()}' is not fully supported`, openapi.value)]);
29+
return new namespace.elements.ParseResult([openapi, createWarning(namespace, `Version '${openapi.value.toValue()}' is not fully supported`, openapi.value)]);
3030
}
3131

3232

packages/fury-adapter-oas3-parser/test/unit/parser/openapi-test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('#parseOpenAPI', () => {
4343
const parseResult = parseOpenAPI(context, openapi);
4444
expect(parseResult).to.be.instanceof(namespace.elements.ParseResult);
4545
expect(parseResult).to.not.contain.annotations;
46+
expect(parseResult.get(0).value.toValue()).to.equal('3.0.0');
4647
});
4748

4849
it('allows openapi patch version 3.0.11', () => {
@@ -51,6 +52,7 @@ describe('#parseOpenAPI', () => {
5152
const parseResult = parseOpenAPI(context, openapi);
5253
expect(parseResult).to.be.instanceof(namespace.elements.ParseResult);
5354
expect(parseResult).to.not.contain.annotations;
55+
expect(parseResult.get(0).value.toValue()).to.equal('3.0.11');
5456
});
5557

5658
it('warns for unsuported minor versions', () => {
@@ -59,5 +61,6 @@ describe('#parseOpenAPI', () => {
5961
const parseResult = parseOpenAPI(context, openapi);
6062
expect(parseResult).to.be.instanceof(namespace.elements.ParseResult);
6163
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');
6265
});
6366
});

0 commit comments

Comments
 (0)