@@ -3,7 +3,7 @@ import { Map, List, fromJS } from "immutable"
3
3
import PropTypes from "prop-types"
4
4
import ImPropTypes from "react-immutable-proptypes"
5
5
import win from "core/window"
6
- import { getExtensions , getCommonExtensions , numberToString , stringify , isEmptyValue , immutableToJS } from "core/utils"
6
+ import { getExtensions , getCommonExtensions , numberToString , stringify , isEmptyValue } from "core/utils"
7
7
import getParameterSchema from "core/utils/get-parameter-schema.js"
8
8
9
9
export default class ParameterRow extends Component {
@@ -152,13 +152,13 @@ export default class ParameterRow extends Component {
152
152
153
153
//// Dispatch the initial value
154
154
155
- const type = fn . jsonSchema202012 . foldType ( immutableToJS ( schema ?. get ( "type" ) ) )
156
- const itemType = fn . jsonSchema202012 . foldType ( immutableToJS ( schema ?. getIn ( [ "items" , "type" ] ) ) )
155
+ const schemaObjectType = fn . getSchemaObjectType ( schema )
156
+ const schemaItemsType = fn . getSchemaObjectType ( schema ?. get ( "items" ) )
157
157
158
158
if ( initialValue !== undefined ) {
159
159
this . onChangeWrapper ( initialValue )
160
160
} else if (
161
- type === "object"
161
+ schemaObjectType === "object"
162
162
&& generatedSampleValue
163
163
&& ! paramWithMeta . get ( "examples" )
164
164
) {
@@ -174,10 +174,10 @@ export default class ParameterRow extends Component {
174
174
stringify ( generatedSampleValue )
175
175
)
176
176
)
177
- }
177
+ }
178
178
else if (
179
- type === "array"
180
- && itemType === "object"
179
+ schemaObjectType === "array"
180
+ && schemaItemsType === "object"
181
181
&& generatedSampleValue
182
182
&& ! paramWithMeta . get ( "examples" )
183
183
) {
@@ -251,17 +251,17 @@ export default class ParameterRow extends Component {
251
251
if ( isOAS3 ) {
252
252
schema = this . composeJsonSchema ( schema )
253
253
}
254
-
254
+
255
255
let format = schema ? schema . get ( "format" ) : null
256
256
let isFormData = inType === "formData"
257
257
let isFormDataSupported = "FormData" in win
258
258
let required = param . get ( "required" )
259
259
260
- const typeLabel = fn . jsonSchema202012 . getType ( immutableToJS ( schema ) )
261
- const type = fn . jsonSchema202012 . foldType ( immutableToJS ( schema ?. get ( "type " ) ) )
262
- const itemType = fn . jsonSchema202012 . foldType ( immutableToJS ( schema ?. getIn ( [ "items" , "type" ] ) ) )
263
- const isObject = ! bodyParam && type === "object"
264
- const isArrayOfObjects = ! bodyParam && itemType === "object"
260
+ const schemaObjectType = fn . getSchemaObjectType ( schema )
261
+ const schemaItemsType = fn . getSchemaObjectType ( schema ?. get ( "items " ) )
262
+ const schemaObjectTypeLabel = fn . getSchemaObjectTypeLabel ( schema )
263
+ const isObject = ! bodyParam && schemaObjectType === "object"
264
+ const isArrayOfObjects = ! bodyParam && schemaItemsType === "object"
265
265
266
266
let value = paramWithMeta ? paramWithMeta . get ( "value" ) : ""
267
267
let commonExt = showCommonExtensions ? getCommonExtensions ( schema ) : null
@@ -322,7 +322,7 @@ export default class ParameterRow extends Component {
322
322
{ ! required ? null : < span > *</ span > }
323
323
</ div >
324
324
< div className = "parameter__type" >
325
- { typeLabel }
325
+ { schemaObjectTypeLabel }
326
326
{ format && < span className = "prop-format" > (${ format } )</ span > }
327
327
</ div >
328
328
< div className = "parameter__deprecated" >
@@ -371,7 +371,7 @@ export default class ParameterRow extends Component {
371
371
}
372
372
373
373
{ ( isObject || isArrayOfObjects ) ? (
374
- < ModelExample
374
+ < ModelExample
375
375
getComponent = { getComponent }
376
376
specPath = { specPath . push ( "schema" ) }
377
377
getConfigs = { getConfigs }
@@ -380,7 +380,7 @@ export default class ParameterRow extends Component {
380
380
schema = { schema }
381
381
example = { jsonSchemaForm }
382
382
/>
383
- ) : jsonSchemaForm
383
+ ) : jsonSchemaForm
384
384
}
385
385
386
386
{
0 commit comments