From 14ef352ce2bb0309c003079adcee6f57dd52d8ba Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 27 Dec 2024 11:00:58 -0500 Subject: [PATCH 01/10] fix: adds version 3.0.4 to supported versions Signed-off-by: Vincent Biret --- README.md | 22 +++++++++++----------- src/core/plugins/oas3/helpers.jsx | 2 +- test/unit/core/plugins/oas3/helpers.js | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8996042e6ed..b45565e4540 100644 --- a/README.md +++ b/README.md @@ -33,17 +33,17 @@ If you are looking for plain ol' HTML/JS/CSS, [download the latest release](http ## Compatibility The OpenAPI Specification has undergone 5 revisions since initial creation in 2010. Compatibility between Swagger UI and the OpenAPI Specification is as follows: -| Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | -|--------------------|--------------|----------------------------------------|-----------------------------------------------------------------------| -| 5.0.0 | 2023-06-12 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0 | [tag v5.0.0](https://github.com/swagger-api/swagger-ui/tree/v5.0.0) | -| 4.0.0 | 2021-11-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v4.0.0](https://github.com/swagger-api/swagger-ui/tree/v4.0.0) | -| 3.18.3 | 2018-08-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.18.3](https://github.com/swagger-api/swagger-ui/tree/v3.18.3) | -| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) | -| 2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) | -| 2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) | -| 2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) | -| 1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) | -| 1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) | +| Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | +|--------------------|--------------|-----------------------------------------------|-----------------------------------------------------------------------| +| 5.0.0 | 2023-06-12 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0 | [tag v5.0.0](https://github.com/swagger-api/swagger-ui/tree/v5.0.0) | +| 4.0.0 | 2021-11-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v4.0.0](https://github.com/swagger-api/swagger-ui/tree/v4.0.0) | +| 3.18.3 | 2018-08-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.18.3](https://github.com/swagger-api/swagger-ui/tree/v3.18.3) | +| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) | +| 2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) | +| 2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) | +| 2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) | +| 1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) | +| 1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) | ## Anonymized analytics diff --git a/src/core/plugins/oas3/helpers.jsx b/src/core/plugins/oas3/helpers.jsx index 9d46eef5435..84b0ced37b8 100644 --- a/src/core/plugins/oas3/helpers.jsx +++ b/src/core/plugins/oas3/helpers.jsx @@ -8,7 +8,7 @@ export function isOAS30(jsSpec) { return ( typeof oasVersion === "string" && - /^3\.0\.([0123])(?:-rc[012])?$/.test(oasVersion) + /^3\.0\.([01234])(?:-rc[012])?$/.test(oasVersion) ) } diff --git a/test/unit/core/plugins/oas3/helpers.js b/test/unit/core/plugins/oas3/helpers.js index 2ff68ad0f60..835af5c86bf 100644 --- a/test/unit/core/plugins/oas3/helpers.js +++ b/test/unit/core/plugins/oas3/helpers.js @@ -13,6 +13,7 @@ describe("isOAS3", function () { it("should recognize valid OAS3 version values", function () { expect(isOAS3Shorthand("3.0.0")).toEqual(true) expect(isOAS3Shorthand("3.0.1")).toEqual(true) + expect(isOAS3Shorthand("3.0.4")).toEqual(true) expect(isOAS3Shorthand("3.0.11111")).toEqual(false) expect(isOAS3Shorthand("3.0.0-rc0")).toEqual(true) }) From 97f1992fdd8b57d0b6cd1ac3c4e4c57317a70f48 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 10 Jan 2025 10:19:15 -0500 Subject: [PATCH 02/10] fix: adds oas 3.1.1 to supported versions Signed-off-by: Vincent Biret --- README.md | 22 +++++++++---------- test/unit/core/plugins/oas31/components/fn.js | 14 ++++++++++++ 2 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 test/unit/core/plugins/oas31/components/fn.js diff --git a/README.md b/README.md index b45565e4540..91f3be9231a 100644 --- a/README.md +++ b/README.md @@ -33,17 +33,17 @@ If you are looking for plain ol' HTML/JS/CSS, [download the latest release](http ## Compatibility The OpenAPI Specification has undergone 5 revisions since initial creation in 2010. Compatibility between Swagger UI and the OpenAPI Specification is as follows: -| Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | -|--------------------|--------------|-----------------------------------------------|-----------------------------------------------------------------------| -| 5.0.0 | 2023-06-12 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0 | [tag v5.0.0](https://github.com/swagger-api/swagger-ui/tree/v5.0.0) | -| 4.0.0 | 2021-11-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v4.0.0](https://github.com/swagger-api/swagger-ui/tree/v4.0.0) | -| 3.18.3 | 2018-08-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.18.3](https://github.com/swagger-api/swagger-ui/tree/v3.18.3) | -| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) | -| 2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) | -| 2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) | -| 2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) | -| 1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) | -| 1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) | +| Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | +|--------------------|--------------|------------------------------------------------------|-----------------------------------------------------------------------| +| 5.0.0 | 2023-06-12 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0, 3.1.1 | [tag v5.0.0](https://github.com/swagger-api/swagger-ui/tree/v5.0.0) | +| 4.0.0 | 2021-11-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v4.0.0](https://github.com/swagger-api/swagger-ui/tree/v4.0.0) | +| 3.18.3 | 2018-08-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.18.3](https://github.com/swagger-api/swagger-ui/tree/v3.18.3) | +| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) | +| 2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) | +| 2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) | +| 2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) | +| 1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) | +| 1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) | ## Anonymized analytics diff --git a/test/unit/core/plugins/oas31/components/fn.js b/test/unit/core/plugins/oas31/components/fn.js new file mode 100644 index 00000000000..7796f3fb699 --- /dev/null +++ b/test/unit/core/plugins/oas31/components/fn.js @@ -0,0 +1,14 @@ +import { isOAS31 } from "core/plugins/oas31/fn"; + +const isOAS31Shorthand = (version) => isOAS31(fromJS({ + openapi: version +})) + +describe("isOAS31", function () { + it("should recognize valid OAS31 version values", function () { + expect(isOAS31Shorthand("3.1.0")).toEqual(true) + expect(isOAS31Shorthand("3.1.1")).toEqual(true) + expect(isOAS31Shorthand("3.2.0")).toEqual(false) + expect(isOAS31Shorthand("3.0.0-rc0")).toEqual(false) + }) +}); From a0b5f3d6a0f357f653e6a569ec08f1fdea5f2c1b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 10 Jan 2025 10:48:41 -0500 Subject: [PATCH 03/10] fix: adds missing function import Signed-off-by: Vincent Biret --- test/unit/core/plugins/oas31/components/fn.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/core/plugins/oas31/components/fn.js b/test/unit/core/plugins/oas31/components/fn.js index 7796f3fb699..f14420d9aae 100644 --- a/test/unit/core/plugins/oas31/components/fn.js +++ b/test/unit/core/plugins/oas31/components/fn.js @@ -1,3 +1,4 @@ +import { fromJS } from "immutable" import { isOAS31 } from "core/plugins/oas31/fn"; const isOAS31Shorthand = (version) => isOAS31(fromJS({ From ac2a64ca8fcbb31f2a808a33414ec92a69b980a5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 17 Feb 2025 10:05:13 -0500 Subject: [PATCH 04/10] docs: adds new version entry in supported versions table Signed-off-by: Vincent Biret --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91f3be9231a..a8bd5a9b439 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ The OpenAPI Specification has undergone 5 revisions since initial creation in 20 | Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | |--------------------|--------------|------------------------------------------------------|-----------------------------------------------------------------------| -| 5.0.0 | 2023-06-12 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0, 3.1.1 | [tag v5.0.0](https://github.com/swagger-api/swagger-ui/tree/v5.0.0) | +| 5.19.0 | 2025-02-17 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0, 3.1.1 | [tag v5.19.0](https://github.com/swagger-api/swagger-ui/tree/v5.19.0) | +| 5.0.0 | 2023-06-12 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0 | [tag v5.0.0](https://github.com/swagger-api/swagger-ui/tree/v5.0.0) | | 4.0.0 | 2021-11-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v4.0.0](https://github.com/swagger-api/swagger-ui/tree/v4.0.0) | | 3.18.3 | 2018-08-03 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.18.3](https://github.com/swagger-api/swagger-ui/tree/v3.18.3) | | 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) | From 21f9d2564ce2fe997dee6f3c3ca3c88db39aa63c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 17 Feb 2025 10:06:58 -0500 Subject: [PATCH 05/10] fix: ensure future patch versions of 3.0 are going to be supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: VladimĂ­r Gorej --- src/core/plugins/oas3/helpers.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/plugins/oas3/helpers.jsx b/src/core/plugins/oas3/helpers.jsx index 84b0ced37b8..d3055b06684 100644 --- a/src/core/plugins/oas3/helpers.jsx +++ b/src/core/plugins/oas3/helpers.jsx @@ -8,7 +8,7 @@ export function isOAS30(jsSpec) { return ( typeof oasVersion === "string" && - /^3\.0\.([01234])(?:-rc[012])?$/.test(oasVersion) + typeof oasVersion === "string" && /^3\.0\.(?:[1-9]\d*|0)$/.test(oasVersion) ) } From 51fde273981df20e45365f6f73edbaf5696ba831 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 17 Feb 2025 10:09:51 -0500 Subject: [PATCH 06/10] fix: removes duplicated type test --- src/core/plugins/oas3/helpers.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/plugins/oas3/helpers.jsx b/src/core/plugins/oas3/helpers.jsx index d3055b06684..62442488f65 100644 --- a/src/core/plugins/oas3/helpers.jsx +++ b/src/core/plugins/oas3/helpers.jsx @@ -8,7 +8,7 @@ export function isOAS30(jsSpec) { return ( typeof oasVersion === "string" && - typeof oasVersion === "string" && /^3\.0\.(?:[1-9]\d*|0)$/.test(oasVersion) + /^3\.0\.(?:[1-9]\d*|0)$/.test(oasVersion) ) } From 2ae6304340401a4a1469b915612a68d6d8405b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Mon, 17 Feb 2025 16:14:12 +0100 Subject: [PATCH 07/10] Refactor isOAS30 function formatting --- src/core/plugins/oas3/helpers.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/plugins/oas3/helpers.jsx b/src/core/plugins/oas3/helpers.jsx index 62442488f65..462250f5649 100644 --- a/src/core/plugins/oas3/helpers.jsx +++ b/src/core/plugins/oas3/helpers.jsx @@ -7,8 +7,7 @@ export function isOAS30(jsSpec) { const oasVersion = jsSpec.get("openapi") return ( - typeof oasVersion === "string" && - /^3\.0\.(?:[1-9]\d*|0)$/.test(oasVersion) + typeof oasVersion === "string" && /^3\.0\.(?:[1-9]\d*|0)$/.test(oasVersion) ) } From 9f89a07a9d245f26c56f24430c8a598efc41af42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Mon, 17 Feb 2025 16:16:28 +0100 Subject: [PATCH 08/10] Fix OAS3 version validation test cases --- test/unit/core/plugins/oas3/helpers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit/core/plugins/oas3/helpers.js b/test/unit/core/plugins/oas3/helpers.js index 835af5c86bf..2da9a221047 100644 --- a/test/unit/core/plugins/oas3/helpers.js +++ b/test/unit/core/plugins/oas3/helpers.js @@ -14,8 +14,10 @@ describe("isOAS3", function () { expect(isOAS3Shorthand("3.0.0")).toEqual(true) expect(isOAS3Shorthand("3.0.1")).toEqual(true) expect(isOAS3Shorthand("3.0.4")).toEqual(true) - expect(isOAS3Shorthand("3.0.11111")).toEqual(false) - expect(isOAS3Shorthand("3.0.0-rc0")).toEqual(true) + expect(isOAS3Shorthand("3.0.11111")).toEqual(true) + expect(isOAS3Shorthand("3.0.0-rc0")).toEqual(false) + + }) it("should fail for invalid OAS3 version values", function () { From 9f62446cf002badb189d72eb3ef5ed21d39e1320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Mon, 17 Feb 2025 16:22:30 +0100 Subject: [PATCH 09/10] Fix missing semicolon in test file --- test/unit/core/plugins/oas31/components/fn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/core/plugins/oas31/components/fn.js b/test/unit/core/plugins/oas31/components/fn.js index f14420d9aae..ee4cbba5081 100644 --- a/test/unit/core/plugins/oas31/components/fn.js +++ b/test/unit/core/plugins/oas31/components/fn.js @@ -12,4 +12,4 @@ describe("isOAS31", function () { expect(isOAS31Shorthand("3.2.0")).toEqual(false) expect(isOAS31Shorthand("3.0.0-rc0")).toEqual(false) }) -}); +}) From 4bfd8d03dd5d49ecf47ccd04b7bf49186f6f8284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Mon, 17 Feb 2025 16:25:29 +0100 Subject: [PATCH 10/10] Fix import statement in fn.js file --- test/unit/core/plugins/oas31/components/fn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/core/plugins/oas31/components/fn.js b/test/unit/core/plugins/oas31/components/fn.js index ee4cbba5081..455940abfd0 100644 --- a/test/unit/core/plugins/oas31/components/fn.js +++ b/test/unit/core/plugins/oas31/components/fn.js @@ -1,5 +1,5 @@ import { fromJS } from "immutable" -import { isOAS31 } from "core/plugins/oas31/fn"; +import { isOAS31 } from "core/plugins/oas31/fn" const isOAS31Shorthand = (version) => isOAS31(fromJS({ openapi: version