feat: add support for OpenAPI 3.0.4 (#10247)
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com> Co-authored-by: Vladimír Gorej <vladimir.gorej@gmail.com>
This commit is contained in:
23
README.md
23
README.md
@@ -33,17 +33,18 @@ If you are looking for plain ol' HTML/JS/CSS, [download the latest release](http
|
|||||||
## Compatibility
|
## Compatibility
|
||||||
The OpenAPI Specification has undergone 5 revisions since initial creation in 2010. Compatibility between Swagger UI and the OpenAPI Specification is as follows:
|
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 |
|
| 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) |
|
| 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) |
|
||||||
| 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) |
|
| 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) |
|
||||||
| 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) |
|
| 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.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) |
|
| 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) |
|
||||||
| 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) |
|
| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) |
|
||||||
| 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.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.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
|
| 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) |
|
||||||
| 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) |
|
| 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.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |
|
| 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
|
## Anonymized analytics
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ export function isOAS30(jsSpec) {
|
|||||||
const oasVersion = jsSpec.get("openapi")
|
const oasVersion = jsSpec.get("openapi")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
typeof oasVersion === "string" &&
|
typeof oasVersion === "string" && /^3\.0\.(?:[1-9]\d*|0)$/.test(oasVersion)
|
||||||
/^3\.0\.([0123])(?:-rc[012])?$/.test(oasVersion)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,11 @@ describe("isOAS3", function () {
|
|||||||
it("should recognize valid OAS3 version values", function () {
|
it("should recognize valid OAS3 version values", function () {
|
||||||
expect(isOAS3Shorthand("3.0.0")).toEqual(true)
|
expect(isOAS3Shorthand("3.0.0")).toEqual(true)
|
||||||
expect(isOAS3Shorthand("3.0.1")).toEqual(true)
|
expect(isOAS3Shorthand("3.0.1")).toEqual(true)
|
||||||
expect(isOAS3Shorthand("3.0.11111")).toEqual(false)
|
expect(isOAS3Shorthand("3.0.4")).toEqual(true)
|
||||||
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 () {
|
it("should fail for invalid OAS3 version values", function () {
|
||||||
|
|||||||
15
test/unit/core/plugins/oas31/components/fn.js
Normal file
15
test/unit/core/plugins/oas31/components/fn.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { fromJS } from "immutable"
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user