swagger-core
swagger-core copied to clipboard
@SecurityScheme requires #type when #ref is used
It's not possible to define a reference with @SecurityScheme without also defining a type.
@SecurityScheme(ref = "another.yaml#/components/securitySchemes/blagh") // <-- Compilation error
More strange is that #name can be null even though it's required at all times so it can be referred to by @SecurityRequirement. Therefore, this would render as:
components:
securitySchemes:
"": # <-- indeterminable value, is that valid?
$ref: 'another.yaml#/components/securitySchemes/blagh'
It is possible to use a SecuritySchemaType#DEFAULT value, but it's not clear if this is the correct usage:
@SecurityScheme(type = SecuritySchemaType.DEFAULT, ref = "another.yaml#/components/securitySchemes/blagh")
Which would give:
components:
securitySchemes:
"": # <-- indeterminable value, is that valid?
type: ""
$ref: 'another.yaml#/components/securitySchemes/blagh'
It appears OAI/OpenAPI-Specification#2064 shows how this should appear.
Therefore, I believe #name should have no default and be mandatory, and #type should default to SecuritySchemaType#DEFAULT.