Create valid paths for model jumping in OAS3

This commit is contained in:
Kyle Shockey
2017-08-03 16:15:47 -07:00
parent ad8bad6ddc
commit b16907ce6d

View File

@@ -18,7 +18,8 @@ export default class ObjectModel extends Component {
render(){ render(){
let { schema, name, isRef, getComponent, depth, ...props } = this.props let { schema, name, isRef, getComponent, depth, ...props } = this.props
let { expandDepth } = this.props let { expandDepth, specSelectors } = this.props
let { isOAS3 } = specSelectors
let description = schema.get("description") let description = schema.get("description")
let properties = schema.get("properties") let properties = schema.get("properties")
let additionalProperties = schema.get("additionalProperties") let additionalProperties = schema.get("additionalProperties")
@@ -30,7 +31,9 @@ export default class ObjectModel extends Component {
const Model = getComponent("Model") const Model = getComponent("Model")
const ModelCollapse = getComponent("ModelCollapse") const ModelCollapse = getComponent("ModelCollapse")
const JumpToPathSection = ({ name }) => <span className="model-jump-to-path"><JumpToPath path={`definitions.${name}`} /></span> const path = isOAS3 && isOAS3() ? `components.schemas.${name}` : `definitions.${name}`
const JumpToPathSection = ({ name }) => <span className="model-jump-to-path"><JumpToPath path={path} /></span>
const collapsedContent = (<span> const collapsedContent = (<span>
<span>{ braceOpen }</span>...<span>{ braceClose }</span> <span>{ braceOpen }</span>...<span>{ braceClose }</span>
{ {