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

[OpenAPI] SecurityRequirement case class produces invalid open api json #3058

Closed
kdelija opened this issue Aug 27, 2024 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@kdelija
Copy link
Contributor

kdelija commented Aug 27, 2024

Describe the bug
When generating OpenApi json. SecurityRequirement adds securitySchemes object that is not a part of OpenApi 3.1.0 specification. For this reason, Swagger Ui is ignoring the security object and it is not forwarding the header/apiKey that is defined to the backend.

To Reproduce
Steps to reproduce the behaviour:
Go to OpenAPISpec test. In the expected result you see security defined as

  "security" : [
    {
      "securitySchemes" : {
        "apiKeyAuth" : []
      }
    }
  ]

Expected behaviour
The test is passing because this is not a valid OpenApi 3.1.0 json. If you read the speficifation you will see that securitySchemes is redundant and the test should look like this:

  "security" : [
    {
      "apiKeyAuth" : []
    }
  ]
@kdelija kdelija added the bug Something isn't working label Aug 27, 2024
kdelija added a commit to kdelija/zio-http that referenced this issue Aug 28, 2024
…hemes field when generating open api json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant