feat: support for showExtensions on Response objects (#6535)

This commit is contained in:
Shelby Sanders
2020-10-21 18:49:39 -07:00
committed by GitHub
parent 50e5f653cc
commit 6a4e52aadb
9 changed files with 115 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ import PropTypes from "prop-types"
import ImPropTypes from "react-immutable-proptypes"
import cx from "classnames"
import { fromJS, Seq, Iterable, List, Map } from "immutable"
import { getSampleSchema, fromJSOrdered, stringify } from "core/utils"
import { getExtensions, getSampleSchema, fromJSOrdered, stringify } from "core/utils"
import { isFunc } from "../utils"
const getExampleComponent = ( sampleResponse, HighlightCode, getConfigs ) => {
@@ -88,9 +88,12 @@ export default class Response extends React.Component {
let { inferSchema } = fn
let isOAS3 = specSelectors.isOAS3()
const { showExtensions } = getConfigs()
let extensions = showExtensions ? getExtensions(response) : null
let headers = response.get("headers")
let links = response.get("links")
const ResponseExtension = getComponent("ResponseExtension")
const Headers = getComponent("headers")
const HighlightCode = getComponent("highlightCode")
const ModelExample = getComponent("modelExample")
@@ -188,6 +191,8 @@ export default class Response extends React.Component {
<Markdown source={ response.get( "description" ) } />
</div>
{ !showExtensions || !extensions.size ? null : extensions.map((v, key) => <ResponseExtension key={`${key}-${v}`} xKey={key} xVal={v} /> )}
{isOAS3 && response.get("content") ? (
<section className="response-controls">
<div