-
Notifications
You must be signed in to change notification settings - Fork 270
Description
Describe the bug
Extremely nitpicky 😅, but I noticed that the OpenApiDocument property for the security field of the OpenAPI object is named SecurityRequirements, instead of Security.
OpenAPI.NET/src/Microsoft.OpenApi/Models/OpenApiDocument.cs
Lines 73 to 77 in e7c74b8
| /// <summary> | |
| /// A declaration of which security mechanisms can be used across the API. | |
| /// </summary> | |
| public IList<OpenApiSecurityRequirement>? SecurityRequirements { get; set; } = | |
| new List<OpenApiSecurityRequirement>(); |
In general, the models & their properties seem to be named after their spec counterparts (but I haven't exhaustively searched for other inconsistencies).
While I wouldn't normally raise issues for issues as minor as this, I thought I'd make this one in this instance because renaming this property would be a breaking change, and v2 is an upcoming major release; so if this is deemed worth fixing, I'd imagine now would be the time for it? (or in v3 hehe). I guess it could also be fixed in a backward-compatible way by renaming the property to Security and adding an [Obsolete] SecurityRequirements => Security?
Expected behavior
Presence of a Security property in OpenApiDocument, but it is named SecurityRequirements instead.
Additional context
The OpenApiOperation property for the security field of the Operation object is named Security, as expected.
OpenAPI.NET/src/Microsoft.OpenApi/Models/OpenApiOperation.cs
Lines 91 to 98 in e7c74b8
| /// <summary> | |
| /// A declaration of which security mechanisms can be used for this operation. | |
| /// The list of values includes alternative security requirement objects that can be used. | |
| /// Only one of the security requirement objects need to be satisfied to authorize a request. | |
| /// This definition overrides any declared top-level security. | |
| /// To remove a top-level security declaration, an empty array can be used. | |
| /// </summary> | |
| public IList<OpenApiSecurityRequirement>? Security { get; set; } = new List<OpenApiSecurityRequirement>(); |