fix: undefined match the wrong output schema (#25971)
This commit is contained in:
parent
87394d2512
commit
1550316b8d
1 changed files with 1 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ import type { AnyObj } from './match-schema-type'
|
||||||
import matchTheSchemaType from './match-schema-type'
|
import matchTheSchemaType from './match-schema-type'
|
||||||
|
|
||||||
export const getMatchedSchemaType = (obj: AnyObj, schemaTypeDefinitions?: SchemaTypeDefinition[]): string => {
|
export const getMatchedSchemaType = (obj: AnyObj, schemaTypeDefinitions?: SchemaTypeDefinition[]): string => {
|
||||||
if(!schemaTypeDefinitions) return ''
|
if(!schemaTypeDefinitions || obj === undefined || obj === null) return ''
|
||||||
const matched = schemaTypeDefinitions.find(def => matchTheSchemaType(obj, def.schema))
|
const matched = schemaTypeDefinitions.find(def => matchTheSchemaType(obj, def.schema))
|
||||||
return matched ? matched.name : ''
|
return matched ? matched.name : ''
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue