This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-06
Channels
- # announcements (5)
- # aws (28)
- # babashka (4)
- # beginners (163)
- # bristol-clojurians (2)
- # calva (4)
- # cider (18)
- # clj-kondo (30)
- # cljs-dev (28)
- # cljsrn (50)
- # clojure (96)
- # clojure-europe (25)
- # clojure-italy (6)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-sweden (7)
- # clojure-uk (32)
- # clojurescript (39)
- # conjure (74)
- # cursive (12)
- # events (1)
- # fulcro (32)
- # helix (71)
- # jackdaw (2)
- # leiningen (10)
- # off-topic (14)
- # pathom (59)
- # rdf (7)
- # re-frame (6)
- # reitit (28)
- # ring (7)
- # shadow-cljs (207)
- # slack-help (2)
- # spacemacs (3)
- # specter (7)
- # sql (12)
- # tools-deps (14)
- # xtdb (32)
@ikitommi Planning on adding XML support for the format negotation. Anything I need to think about in order to accept a PR?
Hi, does anyone have any idea why a closed spec might not throw a 400 when given extra keys? Maybe i mis-understood the documents, but i followed the 'close spec validation' page at Route Data Validation pretty closely and am still not getting a http 200 with extraneous keys. (For a swagger end point on a system border). I thought it was simple as this: https://github.com/joefromct/close-spec-test/blob/master/src/clj/close_spec_test/handler.clj#L70-L74 But this test still fails; it returns an unexpected 200: https://github.com/joefromct/close-spec-test/blob/master/test/clj/close_spec_test/test/handler_test.clj#L31-L33 I must be missing something... any tips appreciated.
I guess i'm unclear on if i declare a spec closed on the :validation, or :spec keys, or :rs/wrap, or do i need to declare the spec with (spell/closed), or if it actually needs assertions in the function matched by the router. or maybe its ideal to do it in a string transformer with spec tools, although i think that would be applied at coercion time, so maybe it needs something with the :coerce key in a route
@joefromct the extra keys are stripped away by default.
you need to change the transformers via coercion options not to do stripping of extra keys and then use closed specs.
@emil0r would be awesome. It should be muuntaja-xml
module, so it’s not enabled by default, like msgpack
and yaml
are.
yes, something like this into route data:
:coercion (reitit.coercion.spec/create {...transformers-without-stripping...})
there could be more options to make it easier, here’s an example from malli-coercion: https://github.com/metosin/reitit/blob/master/modules/reitit-malli/src/reitit/coercion/malli.cljc#L105-L119
It works with my project that uses reitit for requests, the response blows up when I’ve tried to send out a response as XML
@emil0r are you thinking the encoding/decoding would be handle by clojure.data.xml
or something else?
sounds good. I found it was really not json-like at all... so i actually did something else for xml... probably not feasible for the masses but fit my needs
PR is here if you’re interested https://github.com/metosin/muuntaja/pull/114
I had been using https://github.com/joefromct/clj-xmltojson/blob/master/README.org as i was trying to port software from python using https://github.com/martinblech/xmltodict but im' sure it's not performant enough for the masses