fix: models view when object key contains deprecated:true (#6371)
fixes #6369
This commit is contained in:
@@ -43,6 +43,7 @@ export default class ObjectModel extends Component {
|
||||
let requiredProperties = schema.get("required")
|
||||
let infoProperties = schema
|
||||
.filter( ( v, key) => ["maxProperties", "minProperties", "nullable"].indexOf(key) !== -1 )
|
||||
let deprecated = schema.get("deprecated")
|
||||
|
||||
const JumpToPath = getComponent("JumpToPath", true)
|
||||
const Markdown = getComponent("Markdown", true)
|
||||
@@ -92,6 +93,18 @@ export default class ObjectModel extends Component {
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
{
|
||||
!deprecated ? null :
|
||||
<tr className={"property"}>
|
||||
<td>
|
||||
deprecated:
|
||||
</td>
|
||||
<td>
|
||||
true
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
{
|
||||
!(properties && properties.size) ? null : properties.entrySeq().filter(
|
||||
([, value]) => {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
description: "OAS 2.0 sample with Object Model deprecated: true"
|
||||
version: "0.0.1"
|
||||
title: "Swagger Sample"
|
||||
paths:
|
||||
/test/:
|
||||
get:
|
||||
responses:
|
||||
'200':
|
||||
description: Successful Response
|
||||
definitions:
|
||||
IdentificationProfile:
|
||||
type: object
|
||||
deprecated: true
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
message:
|
||||
type: string
|
||||
IDP2:
|
||||
type: array
|
||||
deprecated: true
|
||||
items:
|
||||
type: string
|
||||
@@ -0,0 +1,26 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
description: "OAS 2.0 sample with Object Model deprecated: true"
|
||||
version: "0.0.1"
|
||||
title: "Swagger Sample"
|
||||
paths:
|
||||
/test/:
|
||||
get:
|
||||
responses:
|
||||
'200':
|
||||
description: Successful Response
|
||||
definitions:
|
||||
IdentificationProfile:
|
||||
type: object
|
||||
deprecated: false
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
message:
|
||||
type: string
|
||||
IDP2:
|
||||
type: array
|
||||
deprecated: true
|
||||
items:
|
||||
type: string
|
||||
@@ -0,0 +1,28 @@
|
||||
openapi: 3.0.2
|
||||
info:
|
||||
title: "OAS 3.0 sample with Object Model deprecated: true"
|
||||
version: 0.1.0
|
||||
servers:
|
||||
- url: http://testserver1.com
|
||||
paths:
|
||||
/test/:
|
||||
get:
|
||||
responses:
|
||||
'200':
|
||||
description: Successful Response
|
||||
components:
|
||||
schemas:
|
||||
IdentificationProfile:
|
||||
type: object
|
||||
deprecated: true
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
message:
|
||||
type: string
|
||||
IDP2:
|
||||
type: array
|
||||
deprecated: true
|
||||
items:
|
||||
type: string
|
||||
@@ -0,0 +1,28 @@
|
||||
openapi: 3.0.2
|
||||
info:
|
||||
title: "OAS 3.0 sample with Object Model deprecated: true"
|
||||
version: 0.1.0
|
||||
servers:
|
||||
- url: http://testserver1.com
|
||||
paths:
|
||||
/test/:
|
||||
get:
|
||||
responses:
|
||||
'200':
|
||||
description: Successful Response
|
||||
components:
|
||||
schemas:
|
||||
IdentificationProfile:
|
||||
type: object
|
||||
deprecated: false
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
message:
|
||||
type: string
|
||||
IDP2:
|
||||
type: array
|
||||
deprecated: true
|
||||
items:
|
||||
type: string
|
||||
44
test/e2e-cypress/tests/bugs/6369.js
Normal file
44
test/e2e-cypress/tests/bugs/6369.js
Normal file
@@ -0,0 +1,44 @@
|
||||
describe("#6369: Object model render of field: deprecated", () => {
|
||||
describe("OAS3", () => {
|
||||
it("should display row with td:deprecated when set to true", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas3-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find("tr")
|
||||
.should("have.length", 3)
|
||||
.contains("td", "deprecated")
|
||||
})
|
||||
it("should not display row with td:deprecated when set to false", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas3-no-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find("tr")
|
||||
.should("have.length", 2)
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find(("td:contains(\"deprecated\")"))
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
||||
describe ("OAS2", () => {
|
||||
it("should display row with td:deprecated when set to true", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas2-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object")
|
||||
.contains("td", "deprecated")
|
||||
})
|
||||
it("should not display row with td:deprecated when set to false", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas2-no-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find("tr")
|
||||
.should("have.length", 2)
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find(("td:contains(\"deprecated\")"))
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user