Skip to content

Commit

Permalink
fix: do not crash on incompatible allOf, console.warn instead
Browse files Browse the repository at this point in the history
fixes #1156
  • Loading branch information
RomanHotsiy committed May 10, 2020
1 parent 8460659 commit 6e607b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/Schema/Schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/services/OpenAPIParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6e607b9

Please sign in to comment.