Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/plugins/oas3/components/request-body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const RequestBody = ({

const mediaTypeValue = requestBodyContent.get(contentType, OrderedMap())
const schemaForMediaType = mediaTypeValue.get("schema", OrderedMap())
const examplesForMediaType = mediaTypeValue.get("examples", OrderedMap())
const examplesForMediaType = mediaTypeValue.get("examples", null)

const handleExamplesSelect = (key /*, { isSyntheticChange } */) => {
updateActiveExamplesKey(key)
Expand Down
25 changes: 25 additions & 0 deletions test/e2e-cypress/static/documents/bugs/5455.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
openapi: 3.0.2
info:
title: test
version: 1.0.0
paths:
/foo:
post:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Foo'
responses:
201:
description: Created

components:
schemas:
Foo:
type: object
properties:
foo:
type: string
example: bar
11 changes: 11 additions & 0 deletions test/e2e-cypress/tests/bugs/5455.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// http://github.com/swagger-api/swagger-ui/issues/5455

describe("#5455: Request bodies w/o `examples` should not render a dropdown", () => {
it("should not render a <select> element", () => {
cy.visit("/?url=/documents/bugs/5455.yaml")
.get("#operations-default-post_foo")
.click()
.get(".opblock-section-request-body > .opblock-description-wrapper")
.should("not.have.descendants", "select")
})
})