Skip to content
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

Clarify discriminator + oneOf/anyOf/allOf usage (3.1.1 modified port of #3822) #3846

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

handrews
Copy link
Member

@handrews handrews commented May 23, 2024

This is not a direct port of #3822 (although it is close), for two reasons:

  1. Full-document parsing (Clarify how Schema Objects require full-document parsing (3.1.1) #3758) and 3.1.1-specific implicit component resolution (PR Clarify resolving implicit connections (3.1.1) #3823) means that the 3.0.4 guidance on finding allOf-using schemas is not needed in 3.1.1
  2. @jdesrosiers made some improvements and bug-fixes to the Discriminator Object language in 3.1.1 (PR 3.1.1 discriminator improvements #2618) but not 3.0.4 (because when he submitted the PR, we hadn't decided to do a 3.0.4 yet)

I have tried to merge the improvements as best I can. There were two notable changes to the improved text:

I also revived some of @jdesrosiers 's ideas that were taken out for compatibility reasons and included a co-author credit; see the commit message below.

Once this PR is accepted, I will backport @jdesrosiers 's changes, as merged here, to 3.0.4 and include a co-author credit (unless you'd rather do it yourself, Jason).

Fixes:


Commit message:

This moves some guidance up to the fixed fields section where
it is more obvious, and explicitly designates other configurations
as having undefined behavior.

It also creates subsections to organize the different topics, pulls
key guidance out of the examples and up into those sections,
and provides clarification on the ambiguity of names and URIs.

Finally, it incorporates ideas from @jdesrosiers regarding
the ambiguous mapping syntax submitted in a prior PR, but
does so in a way that meets our compatibility requirements
for patch releases.
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]

This moves some guidance up to the fixed fields section where
it is more obvious, and explicitly designates other configurations
as having undefined behavior.

It also creates subsections to organize the different topics, pulls
key guidance out of the examples and up into those sections,
and provides clarification on the ambiguity of names and URIs.

Finally, it incorporates ideas from @jdesrosiers regarding
the ambiguous `mapping` syntax submitted in a prior PR, but
does so in a way that meets our compatibility requirements
for patch releases.
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]>
@handrews handrews added discriminator clarification requests to clarify, but not change, part of the spec labels May 23, 2024
@handrews handrews added this to the v3.1.1 milestone May 23, 2024
@handrews handrews requested a review from a team May 23, 2024 19:01
Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, minor nits

versions/3.1.1.md Outdated Show resolved Hide resolved
versions/3.1.1.md Show resolved Hide resolved
versions/3.1.1.md Outdated Show resolved Hide resolved
@jdesrosiers
Copy link
Contributor

unless you'd rather do it yourself, Jason

No thanks, you go ahead. But, I appreciate you asking and the recognition. Thanks for getting this work over the finish line.

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.
@handrews handrews marked this pull request as ready for review June 3, 2024 15:32
Copy link
Contributor

@miqui miqui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. 👍

I commented on an empty H4. If that was not intended it should be fixed but everything else looked fine.

Comment on lines +194 to +195
#### <a name="resolvingImplicitConnections"></a>Resolving Implicit Connections

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an empty H4 ... is that what was intended? It looks very odd.

Copy link
Member Author

@handrews handrews Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to keep the markdown validator from complaining about broken links. That section is being added in another PR. I have like 6 different PRs that cross-reference each other and there's no good way to do this. Of the three ways I've tried, this was the only one that @ralfhandl didn't object to.

It will all get sorted as we merge and resolve conflicts.

@ralfhandl
Copy link
Contributor

@handrews Do you want to merge now?

@miqui miqui merged commit 7ca63b5 into OAI:v3.1.1-dev Jun 4, 2024
1 check passed
@handrews handrews deleted the disc-of-311 branch June 4, 2024 19:11
miqui added a commit that referenced this pull request Jun 6, 2024
Backport (3.0.4) of merge resolution from #3846
miqui added a commit that referenced this pull request Jun 6, 2024
Clarify discriminator + oneOf/anyOf/allOf usage (3.2.0 port of #3846)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification requests to clarify, but not change, part of the spec discriminator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants