fix(json-schema-2020-12-samples): fix examples for nullable primitive types defined as list of types (#10390)
This commit is contained in:
@@ -67,7 +67,10 @@ export const foldType = (type) => {
|
||||
} else if (type.includes("object")) {
|
||||
return "object"
|
||||
} else {
|
||||
const pickedType = randomPick(type)
|
||||
const notNullTypes = type.filter((t) => t !== "null")
|
||||
const pickedType = randomPick(
|
||||
notNullTypes.length > 0 ? notNullTypes : type
|
||||
)
|
||||
if (ALL_TYPES.includes(pickedType)) {
|
||||
return pickedType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user