diff --git a/src/core/components/param-body.jsx b/src/core/components/param-body.jsx index e64a65cc..48373f5f 100644 --- a/src/core/components/param-body.jsx +++ b/src/core/components/param-body.jsx @@ -69,7 +69,9 @@ export default class ParamBody extends PureComponent { let { param, fn:{inferSchema} } = this.props let schema = inferSchema(param.toJS()) - return getSampleSchema(schema, xml) + return getSampleSchema(schema, xml, { + includeWriteOnly: true + }) } onChange = (value, { isEditBox, isXml }) => { diff --git a/src/core/components/response.jsx b/src/core/components/response.jsx index 95602c64..818b4337 100644 --- a/src/core/components/response.jsx +++ b/src/core/components/response.jsx @@ -83,11 +83,16 @@ export default class Response extends React.Component { if(isOAS3()) { 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 } else { 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 ) diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index cce3b9f3..2cbf491a 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -16,7 +16,9 @@ const RequestBody = ({ requestBody, getComponent, specSelectors, 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