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

The securityScheme in the OpenAPI specification is being parsed incorrectly #2813

Closed
wi101 opened this issue Apr 30, 2024 · 4 comments · Fixed by #2893
Closed

The securityScheme in the OpenAPI specification is being parsed incorrectly #2813

wi101 opened this issue Apr 30, 2024 · 4 comments · Fixed by #2893
Labels
💎 Bounty bug Something isn't working 💰 Rewarded

Comments

@wi101
Copy link

wi101 commented Apr 30, 2024

Describe the bug
Hi, I am trying to generate the openApi specification using zio-http 3.0.0-RC6
But there seems to be an issue with the securityScheme, it’s not parsed correctly.

To Reproduce
This is the code:

val securitySchemes: ListMap[Key, ReferenceOr[SecurityScheme]] = ListMap(
  Key.fromString("apiKeyAuth").get -> ReferenceOr.Or(
    SecurityScheme.ApiKey(
       None,
      "Authorization",
      ApiKey.In.Header
    )
  )
)
val openApi = OpenAPI.empty.copy(
  security = List(SecurityRequirement(Map("apiKeyAuth" -> List.empty))),
  components = Some(OpenAPI.Components(securitySchemes = securitySchemes))
)
...

And this is how it is parsed

{
  "openapi" : "3.1.0",
  "info" : {
    "title" : "",
    "version" : ""
  },
  "components" : {
    "securitySchemes" : {
      "apiKeyAuth" : 
        {
        "ApiKey" : {     
        "name" : "Authorization",
        "in" : "Header"
      }}
    }
  },
  "security" : [
    {
      "securitySchemes" : {
        "apiKeyAuth" : []
      }
    }
  ]
}

Expected behaviour
The expected format of the securitySchemes is : 


    {
       "type" : "apiKey", 
 
        "name" : "Authorization",
        "in" : "Header"
    }

@wi101 wi101 added the bug Something isn't working label Apr 30, 2024
@jdegoes
Copy link
Member

jdegoes commented Jun 5, 2024

/bounty $75

Copy link

algora-pbc bot commented Jun 5, 2024

💎 $75 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2813 with your implementation plan
  2. Submit work: Create a pull request including /claim #2813 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @987Nabil #2893

987Nabil added a commit to 987Nabil/zio-http that referenced this issue Jun 7, 2024
Copy link

algora-pbc bot commented Jun 7, 2024

💡 @987Nabil submitted a pull request that claims the bounty. You can visit your bounty board to reward.

987Nabil added a commit to 987Nabil/zio-http that referenced this issue Jun 9, 2024
987Nabil added a commit to 987Nabil/zio-http that referenced this issue Jun 9, 2024
987Nabil added a commit to 987Nabil/zio-http that referenced this issue Jun 9, 2024
987Nabil added a commit to 987Nabil/zio-http that referenced this issue Jun 9, 2024
Copy link

algora-pbc bot commented Jun 11, 2024

🎉🎈 @987Nabil has been awarded $75! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 Bounty bug Something isn't working 💰 Rewarded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants