papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
241 stars 42 forks source link

Name-property is added to all security schemes, causing openapi.json to fail validation #68

Closed sigmanil closed 3 years ago

sigmanil commented 4 years ago

As far as I understand https://swagger.io/docs/specification/authentication/ , the "name" property in security schemes should only be used when type=apiKey. This is enforced by the validator at https://editor.swagger.io/ (at least as far as type=http goes). Ktor-OpenAPI-Generator currently seems to include the name-field for all security scheme types (and the field is non-nullable in com.papsign.ktor.openapigen.model.security.SecuritySchemeModel), causing generated documentation to fail validation.

Wicpar commented 4 years ago

I'll have to look into this later, if you think you can go for a nice way to fix that i'll accept a PR.

sigmanil commented 4 years ago

For now, my only idea is to make a special handling for that type of data in the serializer, which didn't strike me as particularly nice... 😬 I'll let you know and/or make a pullreq if I get a good idea.