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

v2: Make it easier to model OpenAPI tags as a hash set #1983

Open
captainsafia opened this issue Dec 11, 2024 · 1 comment
Open

v2: Make it easier to model OpenAPI tags as a hash set #1983

captainsafia opened this issue Dec 11, 2024 · 1 comment
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
Milestone

Comments

@captainsafia
Copy link
Member

The OpenAPI specification states that:

Each tag name in the list MUST be unique.

To reflect this attribute, it would be great if we could model the top-level tags collection in to the document as a hash set of sorts. However, because it is currently modeled as an IList it is difficult to encode this uniqueness constraint in the source:

public IList<OpenApiTag>? Tags { get; set; } = new List<OpenApiTag>();

We should consider taking a breaking change to change the type to ICollectionor IEnumerable so that consumer can initialize a HashSet to enforce the uniqueness constraint.

@RachitMalik12 RachitMalik12 added this to the NET:2.0 milestone Dec 11, 2024
@RachitMalik12 RachitMalik12 added the priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days label Dec 11, 2024
@captainsafia
Copy link
Member Author

I should also add that this will require some sort of comparer implementation for OpenApiTag type. Here's one that we implement currently in ASP.NET Core.

https://github.com/dotnet/aspnetcore/blob/f42307ccd08ee02c885de9427acaf3c8f37fc377/src/OpenApi/src/Comparers/OpenApiTagComparer.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
Projects
None yet
Development

No branches or pull requests

3 participants