@@ -14,13 +14,15 @@ export default class ObjectModel extends Component {
1414 name : PropTypes . string ,
1515 isRef : PropTypes . bool ,
1616 expandDepth : PropTypes . number ,
17- depth : PropTypes . number
17+ depth : PropTypes . number ,
18+ specPath : PropTypes . object . isRequired
1819 }
1920
2021 render ( ) {
21- let { schema, name, isRef, getComponent, getConfigs, depth, expandDepth, ...otherProps } = this . props
22+ let { schema, name, isRef, getComponent, getConfigs, depth, specPath , expandDepth, ...otherProps } = this . props
2223 let { specSelectors } = otherProps
23- let { isOAS3 } = specSelectors
24+
25+ const { isOAS3 } = specSelectors
2426
2527 if ( ! schema ) {
2628 return null
@@ -39,14 +41,13 @@ export default class ObjectModel extends Component {
3941 const Model = getComponent ( "Model" )
4042 const ModelCollapse = getComponent ( "ModelCollapse" )
4143
42- const JumpToPathSection = ( { name } ) => {
43- const path = isOAS3 && isOAS3 ( ) ? `components.schemas.${ name } ` : `definitions.${ name } `
44- return < span className = "model-jump-to-path" > < JumpToPath path = { path } /> </ span >
44+ const JumpToPathSection = ( ) => {
45+ return < span className = "model-jump-to-path" > < JumpToPath specPath = { specPath } /> </ span >
4546 }
4647 const collapsedContent = ( < span >
4748 < span > { braceOpen } </ span > ...< span > { braceClose } </ span >
4849 {
49- isRef ? < JumpToPathSection name = { name } /> : ""
50+ isRef ? < JumpToPathSection /> : ""
5051 }
5152 </ span > )
5253
@@ -63,7 +64,7 @@ export default class ObjectModel extends Component {
6364 < ModelCollapse title = { titleEl } collapsed = { depth > expandDepth } collapsedContent = { collapsedContent } >
6465 < span className = "brace-open object" > { braceOpen } </ span >
6566 {
66- ! isRef ? null : < JumpToPathSection name = { name } />
67+ ! isRef ? null : < JumpToPathSection />
6768 }
6869 < span className = "inner-object" >
6970 {
@@ -94,6 +95,7 @@ export default class ObjectModel extends Component {
9495 < Model key = { `object-${ name } -${ key } _${ value } ` } { ...otherProps }
9596 required = { isRequired }
9697 getComponent = { getComponent }
98+ specPath = { [ ...specPath , "properties" , key ] }
9799 getConfigs = { getConfigs }
98100 schema = { value }
99101 depth = { depth + 1 } />
@@ -132,6 +134,7 @@ export default class ObjectModel extends Component {
132134 < td >
133135 < Model { ...otherProps } required = { false }
134136 getComponent = { getComponent }
137+ specPath = { [ ...specPath , "additionalProperties" ] }
135138 getConfigs = { getConfigs }
136139 schema = { additionalProperties }
137140 depth = { depth + 1 } />
@@ -146,6 +149,7 @@ export default class ObjectModel extends Component {
146149 { anyOf . map ( ( schema , k ) => {
147150 return < div key = { k } > < Model { ...otherProps } required = { false }
148151 getComponent = { getComponent }
152+ specPath = { [ ...specPath , "anyOf" , k ] }
149153 getConfigs = { getConfigs }
150154 schema = { schema }
151155 depth = { depth + 1 } /> </ div >
@@ -161,6 +165,7 @@ export default class ObjectModel extends Component {
161165 { oneOf . map ( ( schema , k ) => {
162166 return < div key = { k } > < Model { ...otherProps } required = { false }
163167 getComponent = { getComponent }
168+ specPath = { [ ...specPath , "oneOf" , k ] }
164169 getConfigs = { getConfigs }
165170 schema = { schema }
166171 depth = { depth + 1 } /> </ div >
@@ -177,6 +182,7 @@ export default class ObjectModel extends Component {
177182 < Model { ...otherProps }
178183 required = { false }
179184 getComponent = { getComponent }
185+ specPath = { [ ...specPath , "not" ] }
180186 getConfigs = { getConfigs }
181187 schema = { not }
182188 depth = { depth + 1 } />
0 commit comments