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
10 changes: 9 additions & 1 deletion src/core/components/parameter-row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ export default class ParameterRow extends Component {

let { schema } = getParameterSchema(param, { isOAS3 })
let paramWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam) || Map()
const parameterMediaType = paramWithMeta
.get("content", Map())
.keySeq()
.first()

if (isOAS3) {
schema = this.composeJsonSchema(schema)
Expand Down Expand Up @@ -373,7 +377,11 @@ export default class ParameterRow extends Component {
{ (isObject || isArrayOfObjects) ? (
<ModelExample
getComponent={getComponent}
specPath={specPath.push("schema")}
specPath={
parameterMediaType
? specPath.push("content", parameterMediaType, "schema")
: specPath.push("schema")
}
getConfigs={getConfigs}
isExecute={isExecute}
specSelectors={specSelectors}
Expand Down
6 changes: 4 additions & 2 deletions src/core/components/response.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react"
import PropTypes from "prop-types"
import ImPropTypes from "react-immutable-proptypes"
import cx from "classnames"
import { fromJS, Seq, Iterable, List, Map } from "immutable"
import { fromJS, Seq, Iterable, Map } from "immutable"
import { getExtensions, fromJSOrdered, stringify } from "core/utils"
import { getKnownSyntaxHighlighterLanguage } from "core/utils/jsonParse"

Expand Down Expand Up @@ -118,7 +118,9 @@ export default class Response extends React.Component {
const oas3SchemaForContentType = activeMediaType.get("schema")

schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
specPathWithPossibleSchema = oas3SchemaForContentType ? List(["content", this.state.responseContentType, "schema"]) : specPath
specPathWithPossibleSchema = oas3SchemaForContentType
? specPath.push("content", this.state.responseContentType, "schema")
: specPath
} else {
schema = response.get("schema")
specPathWithPossibleSchema = response.has("schema") ? specPath.push("schema") : specPath
Expand Down
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 @@ -298,7 +298,7 @@ const RequestBody = ({
expandDepth={1}
isExecute={isExecute}
schema={mediaTypeValue.get("schema")}
specPath={specPath.push("content", contentType)}
specPath={specPath.push("content", contentType, "schema")}
example={example}
includeWriteOnly={true}
/>
Expand Down