Can you set required fields in a request body of fields in a "oneOf" or "anyOf" #3113
Replies: 2 comments
-
you might try https://join.slack.com/t/json-schema/shared_invite/zt-1rptj13ch-ZygpGVq7jUxQYpct0vwsGQ ultimately, this is a JSON Schema behavior. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Closing as this is a JSON Schema question, but the short answer is that you need to put the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have been trying to work out how to set fields as required for a specific method requestBody when I am using a "oneOf" in a schema object.
I know how to set required fields of a referenced object, but when you try set the required properties of oneOf objects the same way, it does not work.
I also know that I can set the required fields in the schema object itself, however I do not want to do this as the required fields differ on each method (i.e all fields required for a post, but only some required for a patch).
So essentially, how do I set the required fields in a request body of a schema used in oneOf?
I have created an example below, in it, I want to:
Any help on this would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions