Skip to content

Commit

Permalink
fix: more descriptive message for wrong discriminator use
Browse files Browse the repository at this point in the history
fixes #505
  • Loading branch information
RomanHotsiy committed May 29, 2018
1 parent 4b41bb1 commit 3c6de2c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/Schema/Schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export class Schema extends React.Component<Partial<SchemaProps>> {
}

if (discriminatorProp !== undefined) {
if (!oneOf || !oneOf.length) {
throw new Error(
`Looks like you are using discriminator wrong: you don't have any definition inherited from the ${
schema.title
}`,
);
}
return (
<ObjectSchema
{...{ ...this.props, schema: oneOf![schema.activeOneOf] }}
Expand Down

0 comments on commit 3c6de2c

Please sign in to comment.