diff --git a/packages/cli/package.json b/packages/cli/package.json index 9c9a4b84a..43e397ee6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -26,7 +26,7 @@ "@apielements/apib-parser": "^0.20.1", "@apielements/apib-serializer": "^0.16.2", "@apielements/core": ">=0.1.0 <0.3.0", - "@apielements/openapi2-parser": "^0.32.3", + "@apielements/openapi2-parser": "^0.32.4", "@apielements/openapi3-parser": "^0.15.0", "cardinal": "^2.1.1", "commander": "^5.1.0", diff --git a/packages/openapi2-parser/CHANGELOG.md b/packages/openapi2-parser/CHANGELOG.md index b37025616..4d94961e3 100644 --- a/packages/openapi2-parser/CHANGELOG.md +++ b/packages/openapi2-parser/CHANGELOG.md @@ -1,5 +1,13 @@ # API Elements: OpenAPI 2 Parser Changelog +## 0.32.4 (2020-10-13) + +### Bug Fixes + +- The HOST URI metadata produced from `schemes`, `host` and `basePath` will now + default to `https` when `schemes` is not defined. Previously a partial URI + without a scheme was returned. + ## 0.32.3 (2020-08-06) Adds compatibility for @apielements/core 0.2.0. diff --git a/packages/openapi2-parser/lib/parser.js b/packages/openapi2-parser/lib/parser.js index be0941589..f48869c3c 100644 --- a/packages/openapi2-parser/lib/parser.js +++ b/packages/openapi2-parser/lib/parser.js @@ -449,6 +449,8 @@ class Parser { } hostname = `${this.swagger.schemes[0]}://${hostname}`; + } else { + hostname = `https://${hostname}`; } const metadata = []; diff --git a/packages/openapi2-parser/package.json b/packages/openapi2-parser/package.json index e61e4a9ae..0d1457bce 100644 --- a/packages/openapi2-parser/package.json +++ b/packages/openapi2-parser/package.json @@ -1,6 +1,6 @@ { "name": "@apielements/openapi2-parser", - "version": "0.32.3", + "version": "0.32.4", "description": "Swagger 2.0 parser for Fury.js", "author": "Apiary.io ", "license": "MIT", @@ -38,7 +38,7 @@ "eslint": "^5.16.0", "glob": "^7.1.2", "mocha": "^7.1.1", - "swagger-zoo": "^3.1.3" + "swagger-zoo": "^3.1.4" }, "engines": { "node": ">=8" diff --git a/packages/openapi2-parser/test/fixtures/circular-example.json b/packages/openapi2-parser/test/fixtures/circular-example.json index f0508f244..6aeb7b573 100644 --- a/packages/openapi2-parser/test/fixtures/circular-example.json +++ b/packages/openapi2-parser/test/fixtures/circular-example.json @@ -46,7 +46,7 @@ }, "value": { "element": "string", - "content": "petstore.swagger.io" + "content": "https://petstore.swagger.io" } } } diff --git a/packages/openapi2-parser/test/fixtures/circular-example.sourcemap.json b/packages/openapi2-parser/test/fixtures/circular-example.sourcemap.json index 753e8f85e..0de45e7c5 100644 --- a/packages/openapi2-parser/test/fixtures/circular-example.sourcemap.json +++ b/packages/openapi2-parser/test/fixtures/circular-example.sourcemap.json @@ -121,7 +121,7 @@ }, "value": { "element": "string", - "content": "petstore.swagger.io" + "content": "https://petstore.swagger.io" } } } diff --git a/packages/openapi2-parser/test/fixtures/invalid-media-type.json b/packages/openapi2-parser/test/fixtures/invalid-media-type.json index 862bafc16..6fdb8cc97 100644 --- a/packages/openapi2-parser/test/fixtures/invalid-media-type.json +++ b/packages/openapi2-parser/test/fixtures/invalid-media-type.json @@ -46,7 +46,7 @@ }, "value": { "element": "string", - "content": "petstore.swagger.io" + "content": "https://petstore.swagger.io" } } } diff --git a/packages/openapi2-parser/test/fixtures/invalid-media-type.sourcemap.json b/packages/openapi2-parser/test/fixtures/invalid-media-type.sourcemap.json index 457a0e1d5..a10607a0f 100644 --- a/packages/openapi2-parser/test/fixtures/invalid-media-type.sourcemap.json +++ b/packages/openapi2-parser/test/fixtures/invalid-media-type.sourcemap.json @@ -121,7 +121,7 @@ }, "value": { "element": "string", - "content": "petstore.swagger.io" + "content": "https://petstore.swagger.io" } } } diff --git a/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.json b/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.json index b942f7a1f..6d81da671 100644 --- a/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.json +++ b/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.json @@ -46,7 +46,7 @@ }, "value": { "element": "string", - "content": "custom-instance.filter.ly" + "content": "https://custom-instance.filter.ly" } } } diff --git a/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.sourcemap.json b/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.sourcemap.json index f9e2c90c4..969a4d666 100644 --- a/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.sourcemap.json +++ b/packages/swagger-zoo/fixtures/features/api-elements/payload-as-string.sourcemap.json @@ -121,7 +121,7 @@ }, "value": { "element": "string", - "content": "custom-instance.filter.ly" + "content": "https://custom-instance.filter.ly" } } } diff --git a/packages/swagger-zoo/package.json b/packages/swagger-zoo/package.json index 722eac435..4bb7e0709 100644 --- a/packages/swagger-zoo/package.json +++ b/packages/swagger-zoo/package.json @@ -1,6 +1,6 @@ { "name": "swagger-zoo", - "version": "3.1.3", + "version": "3.1.4", "description": "Swagger example files for testing", "author": "Apiary.io ", "license": "MIT",