reitit

Schmoho 2024-07-24T13:25:52.274679Z

I am trying to set up a reitit router to produce proper OpenAPI 3.1 specs, but I am having a hard time on an endpoint that takes a multipart-request where one part is a file and which returns a file. This is the OpenAPI spec as it should look like for the response: https://swagger.io/docs/specification/describing-responses/#response-that-returns-a-file And this is what the request should look like: https://swagger.io/docs/specification/describing-request-body/multipart-requests/ For this in the :post map

:parameters {:multipart {:model-file {}}}
                       :responses {200 {:content {"application/octet-stream" {}}}}
the generated JSON looks like this:
"requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "model-file": {
                    "type": "object",
                    "properties": {}
                  }
                },
                "required": [
                  "model-file"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {}
              }
            }
          }
which kind of is off to a bad start as the model-file should not have properties. particularly, I dont know how define type and format as direct children of model-file in the request and schema in the response ... I intended to use spec for the API if that is of any relevance. Any hints would be greatly appreciated

sheluchin 2024-07-24T18:38:20.635649Z

How can I define an optional GET query-param which is a list of strings?

:parameters {:query (s/keys :opt-un [:query/extra-fields])}

;; where extra-fields is
(s/coll-of string? :into [])