Set writeOnly flags in correct places

This commit is contained in:
Kyle Shockey
2017-08-03 17:42:04 -07:00
parent 9af5d2dc66
commit 15b70b6f2d
3 changed files with 13 additions and 4 deletions

View File

@@ -69,7 +69,9 @@ export default class ParamBody extends PureComponent {
let { param, fn:{inferSchema} } = this.props let { param, fn:{inferSchema} } = this.props
let schema = inferSchema(param.toJS()) let schema = inferSchema(param.toJS())
return getSampleSchema(schema, xml) return getSampleSchema(schema, xml, {
includeWriteOnly: true
})
} }
onChange = (value, { isEditBox, isXml }) => { onChange = (value, { isEditBox, isXml }) => {

View File

@@ -83,11 +83,16 @@ export default class Response extends React.Component {
if(isOAS3()) { if(isOAS3()) {
let oas3SchemaForContentType = response.getIn(["content", this.state.responseContentType, "schema"]) let oas3SchemaForContentType = response.getIn(["content", this.state.responseContentType, "schema"])
sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType.toJS(), this.state.responseContentType, { includeReadOnly: true }) : null sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType.toJS(), this.state.responseContentType, {
includeReadOnly: true
}) : null
schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
} else { } else {
schema = inferSchema(response.toJS()) schema = inferSchema(response.toJS())
sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null sampleResponse = schema ? getSampleSchema(schema, contentType, {
includeReadOnly: true,
includeWriteOnly: true // writeOnly has no filtering effect in swagger 2.0
}) : null
} }
let example = getExampleComponent( sampleResponse, examples, HighlightCode ) let example = getExampleComponent( sampleResponse, examples, HighlightCode )

View File

@@ -16,7 +16,9 @@ const RequestBody = ({ requestBody, getComponent, specSelectors, contentType })
const mediaTypeValue = requestBodyContent.get(contentType) const mediaTypeValue = requestBodyContent.get(contentType)
const sampleSchema = getSampleSchema(mediaTypeValue.get("schema").toJS(), contentType) const sampleSchema = getSampleSchema(mediaTypeValue.get("schema").toJS(), contentType, {
includeWriteOnly: true
})
return <div> return <div>
{ requestBodyDescription && { requestBodyDescription &&