ring-swagger

Aneil Mallavarapu 2023-03-21T18:50:00.733299Z

Hi - does anyone know how to get swagger to accept arbitrary query parameters? I have an API endpoint which accepts query params like /api/endpoint?foo=1&bar=2... where foo and bar are not known until runtime. Ideally, I'd like to receive a map, but just being able to receive the string would be fine. I also need the Swagger UI to recognize this and allow me to specify additional parameters. Here are a couple of posts explaining in more detail. https://github.com/metosin/compojure-api/issues/455 https://stackoverflow.com/questions/62714438/swagger-openapi-custom-parameters-in-the-request

Aneil Mallavarapu 2023-03-21T18:55:05.486769Z

Here's an explanation for how to do it using raw Swagger, but I can't figure out how to get it to work with compojure-api: https://stackoverflow.com/questions/49582559/how-to-document-dynamic-query-parameter-names-in-openapi-swagger

Aneil Mallavarapu 2023-03-22T15:04:41.593409Z

Thanks so much, @juhoteperi. Very helpful.

juhoteperi 2023-03-21T20:07:45.624289Z

The first answer mentions this is possible on OpenAPI 3, not 2. Compojure-API just outputs Swagger = OpenAPI 2. > Free-form query parameters can be described using OpenAPI 3.x, but not OpenAPI 2.0

juhoteperi 2023-03-21T20:08:25.216439Z

Next Reitit version will have OpenAPI 3 support though: https://github.com/metosin/reitit/blob/master/CHANGELOG.md#unreleased