Fork me on GitHub
#reitit
<
2020-07-22
>
Sathiya14:07:46

Hi all. I have a query for which i couldn't find a solution. Is it possible to pass a map/json as value to field in multipart/form data

Sathiya14:07:04

"template": {
        "id": "as91",
        "vars": {
            "var1": {
                "var-key-1": "var-value-1",
                "var-key-2": "var-value-2",
                "var-key-3": "var-value-3"
            },
            "var2": {
                "var-key-1": "var-value-1",
                "var-key-2": "var-value-2",
                "var-key-3": "var-value-3"
            }
        }
    }
i need something like this to be passed

ikitommi15:07:08

@kspriyan31 the multipart middleware in reitit is just a thin wrapper around ring multipart mw, which doesn't handle json parts, sorry. You can always parse the part by yourself.

ikitommi15:07:42

Legacy pr to swap the multipart into faster java-version: https://github.com/metosin/muuntaja/pull/82

dharrigan20:07:36

I have a compound spec that has a mandatory field. This field has a regex against it i.e., (def ISO8601 #"(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})[+-](\d{2})\:(\d{2})") and then (s/def ::datetime ISO8601) and then (s/def ::create (s/keys :req-un [::name ::datetime])) This spec is then defined in my route parameters thus :parameters {:body ::specs/create}}}] I have swagger enabled, yet when I visit the swagger ui webpage and look at the POST example, it only shows the model as {"name": "string"} without the datetime field. When I click on model, it rightly shows that datetime is mandatory. Is this a limitation that the swagger generator is unable to show complex types, like a regex (I also tried with a function and that won't show either)?

dharrigan20:07:16

Actually, I'm going to see if I can migrate to malli...it looks like it'll be a better fit.

👍 3