Skip to content

Commit d437474

Browse files
baywetchar0n
andauthored
feat: add support for OpenAPI 3.0.4 (#10247)
Signed-off-by: Vincent Biret <[email protected]> Co-authored-by: Vladimír Gorej <[email protected]>
1 parent 5d1c42c commit d437474

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ If you are looking for plain ol' HTML/JS/CSS, [download the latest release](http
3333
## Compatibility
3434
The OpenAPI Specification has undergone 5 revisions since initial creation in 2010. Compatibility between Swagger UI and the OpenAPI Specification is as follows:
3535

36-
| Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes |
37-
|--------------------|--------------|----------------------------------------|-----------------------------------------------------------------------|
38-
| 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) |
39-
| 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) |
40-
| 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) |
41-
| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) |
42-
| 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) |
43-
| 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) |
44-
| 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) |
45-
| 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) |
46-
| 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) |
36+
| Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes |
37+
|--------------------|--------------|------------------------------------------------------|-----------------------------------------------------------------------|
38+
| 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) |
39+
| 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) |
40+
| 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) |
41+
| 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) |
42+
| 3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21) |
43+
| 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) |
44+
| 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) |
45+
| 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) |
46+
| 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) |
47+
| 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) |
4748

4849
## Anonymized analytics
4950

src/core/plugins/oas3/helpers.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export function isOAS30(jsSpec) {
77
const oasVersion = jsSpec.get("openapi")
88

99
return (
10-
typeof oasVersion === "string" &&
11-
/^3\.0\.([0123])(?:-rc[012])?$/.test(oasVersion)
10+
typeof oasVersion === "string" && /^3\.0\.(?:[1-9]\d*|0)$/.test(oasVersion)
1211
)
1312
}
1413

test/unit/core/plugins/oas3/helpers.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ describe("isOAS3", function () {
1313
it("should recognize valid OAS3 version values", function () {
1414
expect(isOAS3Shorthand("3.0.0")).toEqual(true)
1515
expect(isOAS3Shorthand("3.0.1")).toEqual(true)
16-
expect(isOAS3Shorthand("3.0.11111")).toEqual(false)
17-
expect(isOAS3Shorthand("3.0.0-rc0")).toEqual(true)
16+
expect(isOAS3Shorthand("3.0.4")).toEqual(true)
17+
expect(isOAS3Shorthand("3.0.11111")).toEqual(true)
18+
expect(isOAS3Shorthand("3.0.0-rc0")).toEqual(false)
19+
20+
1821
})
1922

2023
it("should fail for invalid OAS3 version values", function () {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { fromJS } from "immutable"
2+
import { isOAS31 } from "core/plugins/oas31/fn"
3+
4+
const isOAS31Shorthand = (version) => isOAS31(fromJS({
5+
openapi: version
6+
}))
7+
8+
describe("isOAS31", function () {
9+
it("should recognize valid OAS31 version values", function () {
10+
expect(isOAS31Shorthand("3.1.0")).toEqual(true)
11+
expect(isOAS31Shorthand("3.1.1")).toEqual(true)
12+
expect(isOAS31Shorthand("3.2.0")).toEqual(false)
13+
expect(isOAS31Shorthand("3.0.0-rc0")).toEqual(false)
14+
})
15+
})

0 commit comments

Comments
 (0)