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

@@ -0,0 +1,74 @@
/**
* @prettier
*/
describe("JSON Schema 2020-12 examples keyword", () => {
beforeEach(() => {
cy.visit("/?url=/documents/features/json-schema-2020-12-examples.yaml")
})
it("should render `Examples` section", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.get(".json-schema-2020-12-keyword--examples").should("exist")
})
it("should render primitive examples value", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Examples").click()
cy.get(".json-schema-2020-12-keyword--examples")
.contains("#0")
.as("primitiveExample")
.should("exist")
cy.get("@primitiveExample")
.siblings(".json-schema-2020-12-json-viewer__value")
.contains("1")
.should("exist")
})
it("should render array examples value", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Examples").click()
cy.get(".json-schema-2020-12-keyword--examples")
.contains("#1")
.as("arrayExample")
.should("exist")
cy.get("@arrayExample").click()
cy.get("@arrayExample")
.parent()
.contains("#0")
.as("arrayExampleItem")
.should("exist")
cy.get("@arrayExampleItem")
.siblings(".json-schema-2020-12-json-viewer__value")
.contains("2")
.should("exist")
})
it("should render object examples values", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Examples").click()
cy.get(".json-schema-2020-12-keyword--examples")
.contains("#2")
.as("objectExample")
.should("exist")
cy.get("@objectExample").click()
cy.get("@objectExample")
.parent()
.contains("prop")
.as("objectExampleProperty")
.should("exist")
cy.get("@objectExampleProperty")
.siblings(".json-schema-2020-12-json-viewer__value")
.contains("3")
.should("exist")
})
})

View File

@@ -4,17 +4,17 @@
describe("JSON Schema 2020-12 complex keywords expansion", () => {
it("should deeply expand all Schemas and complex keywords", () => {
cy.visit("/pages/json-schema-2020-12-expansion/").then(
() => {
cy.get(".json-schema-2020-12-accordion")
.find(".json-schema-2020-12-accordion__icon--collapsed")
.should("not.exist")
cy.contains("anyOf1-p1-p2-p1").should("exist")
cy.contains("oneOf1-p1-p2-p1").should("exist")
cy.contains("Prefix items").should("exist")
cy.contains("exampleDef").should("exist")
cy.contains("https://json-schema.org/draft/2020-12/vocab/core").should("exist")
}
)
cy.visit("/pages/json-schema-2020-12-expansion/").then(() => {
cy.get(".json-schema-2020-12-accordion")
.find(".json-schema-2020-12-accordion__icon--collapsed")
.should("not.exist")
cy.contains("anyOf1-p1-p2-p1").should("exist")
cy.contains("oneOf1-p1-p2-p1").should("exist")
cy.contains("Prefix items").should("exist")
cy.contains("exampleDef").should("exist")
cy.contains("https://json-schema.org/draft/2020-12/vocab/core").should(
"exist"
)
})
})
})

View File

@@ -0,0 +1,94 @@
/**
* @prettier
*/
describe("JSON Schema 2020-12 extension keywords", () => {
describe("display extension keywords", () => {
beforeEach(() => {
cy.visit(
"/?url=/documents/features/json-schema-2020-12-extension-keywords.yaml&showExtensions=true"
)
})
it("should render `Extension Keywords` section", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.get(".json-schema-2020-12-keyword--extension-keywords").should("exist")
})
it("should render extension keywords with primitive values", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Extension Keywords").click()
cy.get(".json-schema-2020-12-json-viewer-extension-keyword")
.contains("primitiveExtension")
.as("primitiveExtension")
.should("exist")
cy.get("@primitiveExtension")
.siblings(".json-schema-2020-12-json-viewer__value")
.contains("1")
.should("exist")
})
it("should render extension keywords with array values", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Extension Keywords").click()
cy.get(".json-schema-2020-12-json-viewer-extension-keyword")
.contains("arrayExtension")
.should("exist")
cy.contains("arrayExtension").click()
cy.get(".json-schema-2020-12-json-viewer__children")
.contains("#0")
.as("arrayExtensionItem")
.should("exist")
cy.get("@arrayExtensionItem")
.siblings(".json-schema-2020-12-json-viewer__value")
.contains("2")
.should("exist")
})
it("should render extension keywords with object values", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Extension Keywords").click()
cy.get(".json-schema-2020-12-json-viewer-extension-keyword")
.contains("objectExtension")
.should("exist")
cy.contains("objectExtension").click()
cy.get(".json-schema-2020-12-json-viewer__children")
.contains("prop")
.as("objectExtensionProperty")
.should("exist")
cy.get("@objectExtensionProperty")
.siblings(".json-schema-2020-12-json-viewer__value")
.contains("3")
.should("exist")
})
it("should not render OpenAPI 3.1.0 keywords as extension keywords", () => {
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Extension Keywords").click()
cy.get(".json-schema-2020-12-keyword--extension-keywords")
.children()
.contains("Default")
.should("not.exist")
})
})
it("shouldn't display extensions when showExtensions option is set to false", () => {
cy.visit(
"/?url=/documents/features/json-schema-2020-12-extension-keywords.yaml"
)
cy.get(".json-schema-2020-12-accordion").click()
cy.contains("Extension Keywords").should("not.exist")
})
})

View File

@@ -0,0 +1,23 @@
/**
* @prettier
*/
describe("JSON Schema 2020-12 uniqueItems keyword", () => {
beforeEach(() => {
cy.visit("/?url=/documents/features/json-schema-2020-12-unique-items.yaml")
})
it("should render `unique` label", () => {
cy.contains("UniqueItems")
.siblings("span")
.contains("unique")
.should("exist")
})
it("should render `unique items` label with range constraints", () => {
cy.contains("UniqueItemsAndRangeConstraint")
.siblings("span")
.contains("[1, 5] unique items")
.should("exist")
})
})

View File

@@ -0,0 +1,45 @@
/**
* @prettier
*/
describe("Request body with complex schema properties", () => {
beforeEach(() => {
cy.visit(
"/?url=/documents/features/oas3-request-body-complex-schema-properties.yaml"
)
})
it("should render example for properties of type object", () => {
cy.get(".opblock-summary-path span").contains("/object").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example textarea")
.should("exist")
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
})
it("should render schema for properties of type object", () => {
cy.get(".opblock-summary-path span").contains("/object").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .model").should("exist")
})
it("should render example for properties of type array of objects", () => {
cy.get(".opblock-summary-path span").contains("/arrayOfObjects").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example textarea")
.should("exist")
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
})
it("should render schema for properties of type array of objects", () => {
cy.get(".opblock-summary-path span").contains("/arrayOfObjects").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .model").should("exist")
})
})

View File

@@ -0,0 +1,78 @@
/**
* @prettier
*/
describe("Operation parameters with schema and union type", () => {
beforeEach(() => {
cy.visit("/?url=/documents/features/oas31-parameter-schema.yaml")
})
it("should render example for parameters with union type including object", () => {
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
cy.get(".model-example textarea")
.should("exist")
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
})
it("should render schema for parameters with union type including object", () => {
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
it("should render example for parameters with union type including array of objects", () => {
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
cy.get(".model-example textarea")
.should("exist")
.and(
"have.value",
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
)
})
it("should render schema for parameters with union type including array of objects", () => {
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
it("should render example for parameters of type array with union type of items including object", () => {
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
cy.get(".model-example textarea")
.should("exist")
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
})
it("should render schema for parameters of type array with union type of items including object", () => {
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
it("should render example for parameters with union type including array and union type of items including object", () => {
cy.get(".opblock-summary-path span")
.contains("/arrayTypeAndItemTypeUnion")
.click()
cy.get(".model-example textarea")
.should("exist")
.and(
"have.value",
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
)
})
it("should render example for parameters with union type including array and union type of items including object", () => {
cy.get(".opblock-summary-path span")
.contains("/arrayTypeAndItemTypeUnion")
.click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
})

View File

@@ -0,0 +1,89 @@
/**
* @prettier
*/
describe("Request body properties with schema and union type", () => {
beforeEach(() => {
cy.visit(
"/?url=/documents/features/oas31-request-body-complex-schema-properties.yaml"
)
})
it("should render example for properties with union type including object", () => {
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example textarea")
.should("exist")
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
})
it("should render schema for properties with union type including object", () => {
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
it("should render example for properties with union type including array of objects", () => {
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example textarea")
.should("exist")
.and(
"have.value",
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
)
})
it("should render schema for properties with union type including array of objects", () => {
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
it("should render example for properties of type array with union type of items including object", () => {
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example textarea")
.should("exist")
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
})
it("should render schema for properties of type array with union type of items including object", () => {
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
it("should render example for properties with union type including array and union type of items including object", () => {
cy.get(".opblock-summary-path span")
.contains("/arrayTypeAndItemTypeUnion")
.click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example textarea")
.should("exist")
.and(
"have.value",
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
)
})
it("should render example for properties with union type including array and union type of items including object", () => {
cy.get(".opblock-summary-path span")
.contains("/arrayTypeAndItemTypeUnion")
.click()
cy.get("button").contains("Try it out").click()
cy.get(".model-example button").contains("Schema").click()
cy.get(".model-example .json-schema-2020-12").should("exist")
})
})

View File

@@ -0,0 +1,49 @@
/**
* @prettier
*/
describe("OpenAPI 3.1.0 schema expansion", () => {
it("should expand to the default expansion level", () => {
cy.visit(
"/?url=/documents/features/oas31-schema-expansion.yaml&defaultModelsExpandDepth=3&showExtensions=true"
)
cy.get(".json-schema-2020-12-property").contains("prop2").should("exist")
cy.get(".json-schema-2020-12-property")
.contains("prop3")
.should("not.exist")
cy.get(".json-schema-2020-12-keyword--xml")
.contains("x-extension")
.should("exist")
cy.get(".json-schema-2020-12-keyword--xml")
.contains("prop1")
.should("not.exist")
})
it("should deeply expand nested collapsed keywords", () => {
cy.visit(
"/?url=/documents/features/oas31-schema-expansion.yaml&showExtensions=true"
)
cy.get(".json-schema-2020-12-expand-deep-button").click()
cy.get(".json-schema-2020-12-keyword--xml")
.contains("prop4")
.should("exist")
cy.get(".json-schema-2020-12-keyword--xml").contains("prop1").click()
cy.get(".json-schema-2020-12-keyword--xml")
.contains("prop4")
.should("not.exist")
cy.get(".json-schema-2020-12-keyword--xml").contains("XML").click()
cy.get(
".json-schema-2020-12-keyword--xml .json-schema-2020-12-expand-deep-button"
)
.first()
.click()
cy.get(".json-schema-2020-12-keyword--xml")
.contains("prop4")
.should("exist")
})
})