fix(oas3): compensate for JSON Schemas left unresolved by swagger-client (#9794)

Refs #9790
This commit is contained in:
Oliwia Rogala
2024-04-10 08:41:49 +02:00
committed by GitHub
parent b6b0d2879a
commit 3bea389715
3 changed files with 111 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
/**
* @prettier
*/
describe("OpenAPI 3.0 spec with allOf containing a circular reference", () => {
it("should render correct title and properties", () => {
cy.visit("/?url=/documents/features/oas3-all-of-circular-ref.yaml").then(
() => {
cy.get("[id='model-OneOfParent']").find("button").click()
cy.get(".property-row")
.contains("additionalData")
.siblings()
.as("additionalData")
cy.get("@additionalData").find("button").click()
cy.get("@additionalData")
.find("span")
.contains("FirstOneOf")
.should("exist")
.click()
cy.get("@additionalData")
.find("span")
.contains("numberProp")
.should("exist")
cy.get("@additionalData")
.find("span")
.contains("additionalData")
.should("exist")
}
)
})
})

View File

@@ -0,0 +1,69 @@
openapi: 3.0.0
info:
title: Test
description: 'Test'
license:
name: 'Apache 2.0'
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
version: '1.0'
servers:
-
url: 'https://localhost:8000'
components:
schemas:
OneOfParent:
title: OneOfParent
properties:
additionalData:
oneOf:
-
$ref: '#/components/schemas/FirstOneOf'
-
$ref: '#/components/schemas/SecondOneOf'
-
$ref: '#/components/schemas/ThirdOneOf'
type: object
FirstOneOf:
title: FirstOneOf
type: object
allOf:
-
$ref: '#/components/schemas/OneOfParent'
-
properties:
numberProp:
type: number
example: '1'
type: object
SecondOneOf:
title: SecondOneOf
type: object
allOf:
-
$ref: '#/components/schemas/OneOfParent'
-
properties:
person:
properties:
id:
type: string
type: object
type: object
ThirdOneOf:
title: ThirdOneOf
type: object
allOf:
-
$ref: '#/components/schemas/OneOfParent'
-
properties:
person:
properties:
id:
type: string
name:
type: string
surname:
type: string
type: object
type: object