11import React , { Component , } from "react"
22import PropTypes from "prop-types"
33import { List } from "immutable"
4+ import ImPropTypes from "react-immutable-proptypes"
45
56const braceOpen = "{"
67const braceClose = "}"
@@ -17,7 +18,7 @@ export default class ObjectModel extends Component {
1718 isRef : PropTypes . bool ,
1819 expandDepth : PropTypes . number ,
1920 depth : PropTypes . number ,
20- specPath : PropTypes . object . isRequired
21+ specPath : ImPropTypes . list . isRequired
2122 }
2223
2324 render ( ) {
@@ -102,7 +103,7 @@ export default class ObjectModel extends Component {
102103 < Model key = { `object-${ name } -${ key } _${ value } ` } { ...otherProps }
103104 required = { isRequired }
104105 getComponent = { getComponent }
105- specPath = { [ ... specPath , "properties" , key ] }
106+ specPath = { specPath . push ( "properties" , key ) }
106107 getConfigs = { getConfigs }
107108 schema = { value }
108109 depth = { depth + 1 } />
@@ -141,7 +142,7 @@ export default class ObjectModel extends Component {
141142 < td >
142143 < Model { ...otherProps } required = { false }
143144 getComponent = { getComponent }
144- specPath = { [ ... specPath , "additionalProperties" ] }
145+ specPath = { specPath . push ( "additionalProperties" ) }
145146 getConfigs = { getConfigs }
146147 schema = { additionalProperties }
147148 depth = { depth + 1 } />
@@ -156,7 +157,7 @@ export default class ObjectModel extends Component {
156157 { anyOf . map ( ( schema , k ) => {
157158 return < div key = { k } > < Model { ...otherProps } required = { false }
158159 getComponent = { getComponent }
159- specPath = { [ ... specPath , "anyOf" , k ] }
160+ specPath = { specPath . push ( "anyOf" , k ) }
160161 getConfigs = { getConfigs }
161162 schema = { schema }
162163 depth = { depth + 1 } /> </ div >
@@ -172,7 +173,7 @@ export default class ObjectModel extends Component {
172173 { oneOf . map ( ( schema , k ) => {
173174 return < div key = { k } > < Model { ...otherProps } required = { false }
174175 getComponent = { getComponent }
175- specPath = { [ ... specPath , "oneOf" , k ] }
176+ specPath = { specPath . push ( "oneOf" , k ) }
176177 getConfigs = { getConfigs }
177178 schema = { schema }
178179 depth = { depth + 1 } /> </ div >
@@ -189,7 +190,7 @@ export default class ObjectModel extends Component {
189190 < Model { ...otherProps }
190191 required = { false }
191192 getComponent = { getComponent }
192- specPath = { [ ... specPath , "not" ] }
193+ specPath = { specPath . push ( "not" ) }
193194 getConfigs = { getConfigs }
194195 schema = { not }
195196 depth = { depth + 1 } />
0 commit comments