From a9493a27be9e54e09f63781a4c8471dfb624f2f1 Mon Sep 17 00:00:00 2001 From: kyle Date: Sat, 13 Jul 2019 01:01:57 -0500 Subject: [PATCH] fix: Swagger 2.0 `Response.examples`, again (via #5465) * fix: Swagger 2.0 `Response.examples` * stringify results --- src/core/components/response.jsx | 2 +- test/e2e-cypress/tests/bugs/5458.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/components/response.jsx b/src/core/components/response.jsx index cf404d07..81d8ffb8 100644 --- a/src/core/components/response.jsx +++ b/src/core/components/response.jsx @@ -10,7 +10,7 @@ const getExampleComponent = ( sampleResponse, HighlightCode ) => { sampleResponse !== undefined && sampleResponse !== null ) { return
- +
} return null diff --git a/test/e2e-cypress/tests/bugs/5458.js b/test/e2e-cypress/tests/bugs/5458.js index da92e4cc..3c0ccb67 100644 --- a/test/e2e-cypress/tests/bugs/5458.js +++ b/test/e2e-cypress/tests/bugs/5458.js @@ -1,18 +1,22 @@ // http://github.com/swagger-api/swagger-ui/issues/5458 +const expectedValue = `{ + "foo": "custom value" +}` + describe("#5458: Swagger 2.0 `Response.examples` mappings", () => { it("should render a custom example when a schema is not defined", () => { cy.visit("/?url=/documents/bugs/5458.yaml") .get("#operations-default-get_foo1") .click() .get(".model-example .highlight-code") - .contains("custom value") + .contains(expectedValue) }) it("should render a custom example when a schema is defined", () => { cy.visit("/?url=/documents/bugs/5458.yaml") .get("#operations-default-get_foo2") .click() .get(".model-example .highlight-code") - .contains("custom value") + .contains(expectedValue) }) })