Skip to content

OpenApiDocument.SecurityRequirements inconsistently named SecurityRequirements, instead of Security per the OpenAPI spec #2155

@ravindUwU

Description

@ravindUwU

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.

/// <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.

/// <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>();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions