fix: do not crash on incompatible allOf, console.warn instead

fixes #1156
This commit is contained in:
Roman Hotsiy 2020-05-10 21:59:48 +03:00
parent 846065916d
commit 6e607b9a29
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 5 additions and 2 deletions

View File

@ -43,9 +43,10 @@ export class Schema extends React.Component<Partial<SchemaProps>> {
if (discriminatorProp !== undefined) {
if (!oneOf || !oneOf.length) {
throw new Error(
console.warn(
`Looks like you are using discriminator wrong: you don't have any definition inherited from the ${schema.title}`,
);
return null;
}
return (
<ObjectSchema

View File

@ -239,7 +239,9 @@ export class OpenAPIParser {
receiver.type !== undefined &&
subSchema.type !== undefined
) {
throw new Error(`Incompatible types in allOf at "${$ref}"`);
console.warn(
`Incompatible types in allOf at "${$ref}": "${receiver.type}" and "${subSchema.type}"`,
);
}
if (subSchema.type !== undefined) {