fix: avoid rendering empty response schemas (#9667)
Refs #9666 Co-authored-by: Pierre Paysant-Le Roux <ppaysant@gmail.com>
This commit is contained in:
39
test/e2e-cypress/e2e/features/default-model-rendering.cy.js
Normal file
39
test/e2e-cypress/e2e/features/default-model-rendering.cy.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("defaultModelRendering set to model", () => {
|
||||
it("should not render schemas for responses with no defined schemas", () => {
|
||||
cy.visit(
|
||||
"/?defaultModelRendering=model&url=/documents/features/default-model-rendering.yaml"
|
||||
)
|
||||
.get("#operations-default-get_")
|
||||
.click()
|
||||
.get(
|
||||
"#operations-default-get_ [data-code=200] .response-col_description__inner"
|
||||
)
|
||||
.contains("no content")
|
||||
.get("#operations-default-get_ [data-code=200] .model-example")
|
||||
.should("not.exist")
|
||||
.get(
|
||||
"#operations-default-get_ [data-code=201] .response-col_description__inner"
|
||||
)
|
||||
.contains("no schema but an example")
|
||||
.get("#operations-default-get_ [data-code=201] .model-example")
|
||||
.contains('"foo": "bar"')
|
||||
.should("exist")
|
||||
.get(
|
||||
"#operations-default-get_ [data-code=202] .response-col_description__inner"
|
||||
)
|
||||
.contains("no schema but examples")
|
||||
.get("#operations-default-get_ [data-code=202] .model-example")
|
||||
.contains('"foo": "bar"')
|
||||
.should("exist")
|
||||
.get(
|
||||
"#operations-default-get_ [data-code=203] .response-col_description__inner"
|
||||
)
|
||||
.contains("no schema no example")
|
||||
.get("#operations-default-get_ [data-code=203] .model-example")
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user