소스 검색

fix: empty ModelExample rendering in a Response w/o `content` (via #5504)

* add failing test

* use falsy notSetValue for oas3SchemaForContentType
bubble
kyle 5 년 전
committed by GitHub
부모
커밋
39f8ceba55
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
3개의 변경된 파일22개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -1
      src/core/components/response.jsx
  2. +10
    -0
      test/e2e-cypress/static/documents/bugs/5453.yaml
  3. +11
    -0
      test/e2e-cypress/tests/bugs/5453.js

+ 1
- 1
src/core/components/response.jsx 파일 보기

@@ -109,7 +109,7 @@ export default class Response extends React.Component {

// Goal: find a schema value for `schema`
if(isOAS3) {
const oas3SchemaForContentType = activeMediaType.get("schema", Map({}))
const oas3SchemaForContentType = activeMediaType.get("schema")

schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
specPathWithPossibleSchema = oas3SchemaForContentType ? List(["content", this.state.responseContentType, "schema"]) : specPath


+ 10
- 0
test/e2e-cypress/static/documents/bugs/5453.yaml 파일 보기

@@ -0,0 +1,10 @@
openapi: 3.0.2
info:
title: Response without a schema
version: 1.0.0
paths:
/foo:
get:
responses:
'200':
description: OK

+ 11
- 0
test/e2e-cypress/tests/bugs/5453.js 파일 보기

@@ -0,0 +1,11 @@
// http://github.com/swagger-api/swagger-ui/issues/5453

describe("#5453: Responses w/o `content` should not render ModelExample", () => {
it("should not render a ModelExample section", () => {
cy.visit("/?url=/documents/bugs/5453.yaml")
.get("#operations-default-get_foo")
.click()
.get(".responses-inner")
.should("not.have.descendants", ".model-example")
})
})

불러오는 중...
취소
저장