reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
2020-07-22T14:39:46.321100Z

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

2020-07-22T14:43:04.321600Z

"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

ikitommi 2020-07-22T15:17:08.324400Z

@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.

2020-07-22T15:17:38.324600Z

thanks @ikitommi

ikitommi 2020-07-22T15:17:42.324700Z

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

dharrigan 2020-07-22T20:01:36.329500Z

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)?

dharrigan 2020-07-22T20:28:16.330100Z

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

👍 1