How can I configure swagger to send multiple enum string values in vector? Swagger is sending those as comma separated values. Curling with multiple params like ?fields=properties&fields=location ends up into array and works fine. See thread for code.
error from s/explain
schema
;; TODO: doesn't work from swagger, sending as comma separated values
(def legacy-fields #{"properties"
"schoolUse"
"email"
"type.name"
"reservationsLink"
"location.sportsPlaces"
"renovationYears"
"admin"
"location.coordinates.tm35fin"
"www"
"location.geometries"
"name"
"type.typeCode"
"location.locationId"
"constructionYear"
"freeUse"
"location.city.name"
"lastModified"
"marketingName"
"location.postalCode"
"location.postalOffice"
"location.city.cityCode"
"phoneNumber"
"location.neighborhood"
"owner"
"location.coordinates.wgs84"
"location.address"})
(s/def :lipas.legacy.api/field
(st/spec {:spec legacy-fields
:swagger/type "enum"
:swagger/enum legacy-fields}))
(s/def :lipas.legacy.api/fields
(s/coll-of :lipas.legacy.api/field
:distinct true
:min-count 1
:max-count (count legacy-fields)
:into []))
(s/explain :lipas.legacy.api/fields "properties,name")
; "properties,name" - failed: coll? spec: :lipas.legacy.api/fieldsFrom swagger ui the fields looks perfect.
Looks like I need to configure collectionFormat, where it should be declared? source: https://swagger.io/docs/specification/v2_0/describing-parameters/#array-and-multi-value-parameters
There seems to be :collection-format option here
https://github.com/metosin/ring-swagger?tab=readme-ov-file#customizing-swagger-spec-output
Thanks!
Found the root cause: https://github.com/metosin/reitit/issues/298
should there be malli-coercion for compojure-api?