-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Backport (3.0.4) of merge resolution from #3846 #3880
Conversation
handrews
commented
Jun 4, 2024
- Backports merge resolutions from Clarify discriminator + oneOf/anyOf/allOf usage (3.1.1 modified port of #3822) #3846, which was a merge of:
- 3.1.1 discriminator improvements #2618
- Clarify discriminator "*Of" and "mapping" usage (3.0.4) #3822
This backports changes made to the Discriminator Object in 3.1.1 and merges them with the changes made on this branch. Note that the previouc changes incorporated reworked ideas from @jdesrosiers regarding the ambiguous `mapping` syntax submitted in the 3.1.1 changes but not accepted at that time due to compatibility concerns. This commit merges in the parts of that 3.1.1 change that were accepted. For the same compatibility reasons, the MUST wording for requiring the named discriminator property in the schema was (regrettably) weakened to a "SHOULD but otherwise undefined", as we have done for other problematic ambiguities. Co-authored-by: Jason Desrosiers <[email protected]>
I found the "discriminator value" language confusing, because `discriminator` is the field name, and in most cases the value of a field is the value in the OpenAPI Description. Reviewers did not like "discriminator property value", but "discriminating value" makes it clear that this is about the value that actually causes schema selection, and not about the value of the discriminator keyword. Also removed placeholder in favor of just having the headings, as has been done in several other PRs that overlap with new section PRs for internal linking.
90413b1
to
1308aa8
Compare
|
||
##### Fixed Fields | ||
Field Name | Type | Description | ||
---|:---:|--- | ||
<a name="propertyName"></a>propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value. | ||
<a name="propertyName"></a>propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined. | ||
<a name="discriminatorMapping"></a> mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprising: we don't explicitly allow specification extensions here in 3.0.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was surprised enough to check 3.0.3 and 3.0.0 to be sure, and we do not allow them.