Skip to content

Commit 3c6de2c

Browse files
committed
fix: more descriptive message for wrong discriminator use
fixes #505
1 parent 4b41bb1 commit 3c6de2c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/Schema/Schema.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ export class Schema extends React.Component<Partial<SchemaProps>> {
4040
}
4141

4242
if (discriminatorProp !== undefined) {
43+
if (!oneOf || !oneOf.length) {
44+
throw new Error(
45+
`Looks like you are using discriminator wrong: you don't have any definition inherited from the ${
46+
schema.title
47+
}`,
48+
);
49+
}
4350
return (
4451
<ObjectSchema
4552
{...{ ...this.props, schema: oneOf![schema.activeOneOf] }}

0 commit comments

Comments
 (0)