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

Swagger Custom Mappings not working with multiples parameters #444

Open
samirbraga opened this issue Feb 14, 2022 · 1 comment
Open

Swagger Custom Mappings not working with multiples parameters #444

samirbraga opened this issue Feb 14, 2022 · 1 comment

Comments

@samirbraga
Copy link

I'm trying to document a simple Pagination object in swagger-custom-mappings.yml this way:

- type: Pagination
  required: false
  specAsParameter:
    - type: integer
      name: pageSize
    - type: integer
      name: page

But, the rendered result is it:
image

Looking at the code, I found this block where only the first element of specAsParameter array is really interpreted correctly with type and etc. For example, in another object, I've used a list of filters as a query string parameter, but the type array can't be placed in another position than not first.

csp.specAsParameter match {
case head :: tail
def withPrefix(input: JsObject): JsObject = {
if (swaggerV3) Json.obj("schema" -> input) else input
}
val nullableName = if (swaggerV3) "nullable" else "x-nullable"
val under = if (swaggerV3) __ \ "schema" else __
val w = (
(__ \ 'name).write[String] ~
(__ \ 'required).write[Boolean] ~
(under \ nullableName).writeNullable[Boolean] ~
(under \ 'default).writeNullable[JsValue])(
(c: CustomSwaggerParameter) (c.name, c.required, c.nullable, c.default))
(w.writes(csp) ++ withPrefix(head)) :: tail
case Nil Nil

Why this behavior?

@Javakky-pxv
Copy link
Collaborator

@samirbraga
We are currently reviewing it. It may take some time, but we plan to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants