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

Use URI references for Security Requirements in 3.2 #3776

Open
handrews opened this issue May 2, 2024 · 3 comments
Open

Use URI references for Security Requirements in 3.2 #3776

handrews opened this issue May 2, 2024 · 3 comments
Assignees
Labels
enhancement re-use: ref/id resolution how $ref, operationId, or anything else is resolved re-use: ref-everywhere Requests to support referencing in more / all places security: config The mechanics of severs and structure of security-related objects
Milestone

Comments

@handrews
Copy link
Member

handrews commented May 2, 2024

Resolving component names used in referenced (as opposed to entry) documents is ambiguous, particularly in 3.1 where we advertise the ability to have a components-only document to use as a shared component library. Historically, component names were resolved from the entry document, as reference targets were extracted from the document in which they were found without regard for the contents of the rest of the document.

In 3.1, whole-document parsing is required to properly implement the Schema Object, and there is a reasonable intuition that component names should be resolved within the document in which they appear. This is at odds with the historical behavior, and one could argue that for Security Schemes in particular, it makes sense to treat them as part of the "deployment" aspect of things, which is arguably more relevant to the entry document.

For the Discriminator Object, the ambiguity can avoided by using the mapping keyword with unambiguous URI-references (meaning URI-references that are not syntactically valid as component names). There is no similar workaround for the Security Requirement Object.

Adding a URI-reference mechanism for Security Requirements, whether by allowing $ref somewhere, or just allowing URI-references as keys in place of the current component names, will make it possible to write unambiguous security requirements.

@handrews handrews added enhancement review re-use: ref-everywhere Requests to support referencing in more / all places re-use: ref/id resolution how $ref, operationId, or anything else is resolved security: config The mechanics of severs and structure of security-related objects labels May 2, 2024
@handrews handrews added this to the v3.2.0 milestone May 2, 2024
@handrews handrews self-assigned this May 2, 2024
@handrews handrews removed the review label May 19, 2024
@handrews
Copy link
Member Author

handrews commented Aug 28, 2024

[NOTE: tags are no longer covered by this issue, see comments below]

There is a similar issue with tags. While a tag doesn't need to connect to a Tag Object, it is similarly ambiguos as to which Tag Objects are "in scope", and any choice made makes it impossible to connect to whichever Tag Objects (or Security Scheme Objects) are deemed "out of scope."

I'm going to write a proposal on this to consider a couple of options holistically.

@handrews handrews changed the title Use URI references for Security Requirements in 3.2 Use URI references for Security Requirements and Tags in 3.2 Aug 28, 2024
@kevinswiber
Copy link
Contributor

kevinswiber commented Oct 4, 2024

@handrews Security Requirement Objects could definitely use this. I'm actually okay with tags working this way in the 3.x release lines. We could be more explicit that Tag Objects will be resolved in the order that all documents are resolved in the description and may be overwritten upon duplicate declarations. Linting can check for duplicates. I'd suggest revisiting tags in Moonwalk.

@handrews
Copy link
Member Author

I'm going to take tags out of this, because they have challenges that Security Requirements do not, and (as @kevinswiber notes) are not as much of a problem. See issue #3853 (Consolidated $ref-to-Some Object feature request) to track further thoughts on URI-references to Tag Objects (among others).

@handrews handrews changed the title Use URI references for Security Requirements and Tags in 3.2 Use URI references for Security Requirements in 3.2 Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement re-use: ref/id resolution how $ref, operationId, or anything else is resolved re-use: ref-everywhere Requests to support referencing in more / all places security: config The mechanics of severs and structure of security-related objects
Projects
None yet
Development

No branches or pull requests

2 participants