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

Generated response headers structure is invalid #232

Closed
REDNBLACK opened this issue Jan 6, 2020 · 1 comment
Closed

Generated response headers structure is invalid #232

REDNBLACK opened this issue Jan 6, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@REDNBLACK
Copy link
Collaborator

REDNBLACK commented Jan 6, 2020

Given piece of code:

implicit final val RedirectSwagger: MkSwagger[Complete[Redirect]] = MkSwagger.single[Complete[Redirect]](
    OpenApiOp(
      responses = OpenApiResponses(
        codes = Map(Found.intValue -> OpenApiResponse(
          description = "Редирект на страницу".some,
          headers = Map(Location.name -> SwaggerStringValue(pattern = """https:\/\/(?:.+)?""".some))
        ))
      )
    ),
    TreeMap.empty
  )

... generates invalid format:

  "302": {
    "description": "Редирект на страницу",
    "content": {},
    "headers": {
      "Location": {
        "pattern": "https:\\/\\/(?:.+)?",
        "type": "string"
      }
    }
  }

Correct example in spec:

"headers": {
    "X-Rate-Limit-Limit": {
      "description": "The number of allowed requests in the current period",
      "schema": {
        "type": "integer"
      }
    }
}
@REDNBLACK REDNBLACK added the bug Something isn't working label Jan 6, 2020
ulanzetz added a commit to ulanzetz/typed-schema that referenced this issue Jan 10, 2020
@REDNBLACK
Copy link
Collaborator Author

Fixed in #236

Odomontois added a commit that referenced this issue Feb 12, 2020
Fix response headers swagger #232
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