oliyh / martian

The HTTP abstraction library for Clojure/script, supporting OpenAPI, Swagger, Schema, re-frame and more
MIT License
529 stars 44 forks source link

Explode object for object query parameters #206

Open felixdo opened 3 months ago

felixdo commented 3 months ago

Trying to make spring pageable parameters work. The generated OpenAPI schema is:

"parameters": [
          {
            "name": "pageable",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Pageable"
            }
          }
[...]
"Pageable": {
        "type": "object",
        "properties": {
          "page": {
            "minimum": 0,
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "minimum": 1,
            "type": "integer",
            "format": "int32"
          },
          "sort": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }

And spring wants that as ?page=...&size=..... Afaict this is the "exploded, form" style for openapi serialization of object query parameters, and this is the expected format for this combination. From martian I get however: pageable%5Bpage%5D=10. Not sure if this is an easy fix, there are a gazillion different ways to represent parameters in the openapi spec.

felixdo commented 3 months ago

Oh, i just see... this is then actually handled by the backend, in my case clj-http. Will check there.