feat: Display nullable for object model itself (#5660) (#5868)

This commit is contained in:
Vladimir
2020-06-23 09:01:33 +08:00
committed by GitHub
parent e1e4d5bf83
commit 41e595beda
5 changed files with 80 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
openapi: 3.0.2
info:
title: test
description: Nullable model itself
version: '1.0'
paths: {}
components:
schemas:
SomeObject:
type: object
properties:
name:
type: string
nullable: true

View File

@@ -0,0 +1,17 @@
openapi: 3.0.2
info:
title: test
description: Nullable object in model property
version: '1.0'
paths: {}
components:
schemas:
SomeObject:
type: object
properties:
meta:
type: object
properties:
tag:
type: string
nullable: true

View File

@@ -0,0 +1,20 @@
// http://github.com/swagger-api/swagger-ui/issues/5660
const expectedValue = "nullable: true"
describe("#5660: Nullable object", () => {
it("should render `nullable` marker for object ifself", () => {
cy.visit("/?url=/documents/bugs/5660-model.yaml")
.get("#model-SomeObject .model-toggle")
.click()
.get("#model-SomeObject > .model-box")
.contains(expectedValue)
})
it("should render `nullable` marker for nexted object in property", () => {
cy.visit("/?url=/documents/bugs/5660-property.yaml")
.get("#model-SomeObject .model-toggle")
.click()
.get("#model-SomeObject > .model-box")
.contains(expectedValue)
})
})