feat: apply cumulative update to address various issues (#10324)

This commit is contained in:
Vladimír Gorej
2025-02-27 11:12:42 +01:00
committed by GitHub
parent 621a7f0f76
commit 80d56c9518
298 changed files with 11066 additions and 11680 deletions

View File

@@ -1,7 +1,7 @@
import { fromJS } from "immutable"
import { isOAS30, isSwagger2 } from "core/plugins/oas3/helpers"
const isOAS3Shorthand = (version) => isOAS30(fromJS({
const isOAS30Shorthand = (version) => isOAS30(fromJS({
openapi: version
}))
@@ -9,45 +9,46 @@ const isSwagger2Shorthand = (version) => isSwagger2(fromJS({
swagger: version
}))
describe("isOAS3", function () {
describe("isOAS30", 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(true)
expect(isOAS3Shorthand("3.0.0-rc0")).toEqual(false)
expect(isOAS30Shorthand("3.0.0")).toEqual(true)
expect(isOAS30Shorthand("3.0.1")).toEqual(true)
expect(isOAS30Shorthand("3.0.2")).toEqual(true)
expect(isOAS30Shorthand("3.0.3")).toEqual(true)
expect(isOAS30Shorthand("3.0.4")).toEqual(true)
expect(isOAS30Shorthand("3.0.25")).toEqual(true)
})
it("should fail for invalid OAS3 version values", function () {
expect(isOAS3Shorthand("3.0")).toEqual(false)
expect(isOAS3Shorthand("3.0.")).toEqual(false)
expect(isOAS3Shorthand("2.0")).toEqual(false)
expect(isOAS30Shorthand("3.0")).toEqual(false)
expect(isOAS30Shorthand("3.0.")).toEqual(false)
expect(isOAS30Shorthand("3.0.01")).toEqual(false)
expect(isOAS30Shorthand("2.0")).toEqual(false)
expect(isOAS30Shorthand("3.0.0-rc0")).toEqual(false)
})
it("should gracefully fail for non-string values", function () {
expect(isOAS3Shorthand(3.0)).toEqual(false)
expect(isOAS3Shorthand(3)).toEqual(false)
expect(isOAS3Shorthand({})).toEqual(false)
expect(isOAS3Shorthand(null)).toEqual(false)
expect(isOAS30Shorthand(3.0)).toEqual(false)
expect(isOAS30Shorthand(3)).toEqual(false)
expect(isOAS30Shorthand({})).toEqual(false)
expect(isOAS30Shorthand(null)).toEqual(false)
})
it("should gracefully fail when `openapi` field is missing", function () {
expect(isOAS30(fromJS({
openApi: "3.0.0"
openApi: "3.0.4"
}))).toEqual(false)
expect(isOAS3Shorthand(null)).toEqual(false)
expect(isOAS30Shorthand(null)).toEqual(false)
})
})
describe("isSwagger2", function () {
it("should recognize valid Swagger 2.0 version values", function () {
expect(isSwagger2Shorthand("2.0")).toEqual(true)
expect(isSwagger2Shorthand("2.0-rc0")).toEqual(false)
})
it("should fail for invalid Swagger 2.0 version values", function () {
expect(isSwagger2Shorthand("2.0-rc0")).toEqual(false)
expect(isSwagger2Shorthand("3.0")).toEqual(false)
expect(isSwagger2Shorthand("3.0.")).toEqual(false)
expect(isSwagger2Shorthand("2.1")).toEqual(false)

View File

@@ -25,7 +25,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -55,7 +55,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -89,7 +89,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -126,7 +126,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -170,7 +170,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -211,7 +211,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -266,7 +266,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -320,7 +320,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}
@@ -349,7 +349,7 @@ describe("OAS3 plugin - state", function() {
return {
specSelectors: {
specJson: () => {
return fromJS({ openapi: "3.0.0" })
return fromJS({ openapi: "3.0.4" })
},
isOAS3: () => true,
}

View File

@@ -15,7 +15,7 @@ describe("oas3 plugin - auth extensions - wrapSelectors", function(){
getState: () => new Map(),
specSelectors: {
specJson: () => fromJS({
openapi: "3.0.0"
openapi: "3.0.4"
}),
isOAS3: () => true,
securityDefinitions: () => {

View File

@@ -8,7 +8,7 @@ describe("oas3 plugin - spec extensions - wrapSelectors", function(){
// Given
const spec = fromJS({
openapi: "3.0.0",
openapi: "3.0.4",
components: {
schemas: {
a: {
@@ -48,7 +48,7 @@ describe("oas3 plugin - spec extensions - wrapSelectors", function(){
// Given
const spec = fromJS({
openapi: "3.0.0"
openapi: "3.0.4"
})
const system = {
@@ -71,7 +71,7 @@ describe("oas3 plugin - spec extensions - wrapSelectors", function(){
// Given
const spec = fromJS({
openapi: "3.0.0",
openapi: "3.0.4",
components: {
schemas: "..."
}