-
-
Notifications
You must be signed in to change notification settings - Fork 463
Use mapping to directly validate mapped schema #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
45d4919
be8af26
9aa5c5a
146d4b9
b343c1d
f937147
7800000
781e68f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,26 +107,4 @@ func Example() { | |
fmt.Println(err) | ||
} | ||
// Output: | ||
// request body has an error: doesn't match the schema: Doesn't match schema "oneOf" | ||
// Schema: | ||
// { | ||
// "discriminator": { | ||
// "propertyName": "pet_type" | ||
// }, | ||
// "oneOf": [ | ||
// { | ||
// "$ref": "#/components/schemas/Cat" | ||
// }, | ||
// { | ||
// "$ref": "#/components/schemas/Dog" | ||
// } | ||
// ] | ||
// } | ||
// | ||
// Value: | ||
// { | ||
// "bark": true, | ||
// "breed": "Dingo", | ||
// "pet_type": "Cat" | ||
// } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand the request data should be invalid per the provided schema. What am I missing? The test used to not pass because there was no output, because no error is returned. Are you sure this should not output anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This relates to your original question about not being sure regarding the presence of the " Quoting from https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
I'm interpreting this as saying that if you don't specify the mapping the default mapping is based on the names of the objects included in the oneOf list: Because of that "else", Let me know if you believe I'm getting it all wrong or it makes sense. Side note: the fact that now a "barking cat" is legitimate in the |
||
} |
Uh oh!
There was an error while loading. Please reload this page.