Skip to content

Commit

Permalink
fix: label models section as Schemas in OpenAPI 3 (via swagger-api#…
Browse files Browse the repository at this point in the history
…5065)

* fix: label models section `Schemas` in OpenAPI 3

* Update swos-63.js
  • Loading branch information
shockey authored and deepjia committed Feb 25, 2019
1 parent b47bb3e commit 205734a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/core/components/models.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class Models extends Component {

let showModels = layoutSelectors.isShown("models", defaultModelsExpandDepth > 0 && docExpansion !== "none")
const specPathBase = this.getSchemaBasePath()
const isOAS3 = specSelectors.isOAS3()

const ModelWrapper = getComponent("ModelWrapper")
const Collapse = getComponent("Collapse")
Expand All @@ -45,7 +46,7 @@ export default class Models extends Component {

return <section className={ showModels ? "models is-open" : "models"}>
<h4 onClick={() => layoutActions.show("models", !showModels)}>
<span>Models</span>
<span>{isOAS3 ? "Schemas" : "Models" }</span>
<svg width="20" height="20">
<use xlinkHref={showModels ? "#large-arrow-down" : "#large-arrow"} />
</svg>
Expand Down
14 changes: 14 additions & 0 deletions test/e2e-cypress/tests/bugs/swos-63.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe("SWOS-63: Schema/Model section labeling", () => {
it("should render `Schemas` for OpenAPI 3", () => {
cy
.visit("/?url=/documents/petstore-expanded.openapi.yaml")
.get("section.models > h4")
.contains("Schemas")
})
it("should render `Models` for OpenAPI 2", () => {
cy
.visit("/?url=/documents/petstore.swagger.yaml")
.get("section.models > h4")
.contains("Models")
})
})

0 comments on commit 205734a

Please sign in to comment.