This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-19
Channels
- # beginners (134)
- # boot (4)
- # cider (23)
- # clara (2)
- # cljs-dev (2)
- # cljsrn (4)
- # clojure (147)
- # clojure-austin (9)
- # clojure-berlin (2)
- # clojure-dusseldorf (2)
- # clojure-france (2)
- # clojure-italy (11)
- # clojure-russia (1)
- # clojure-spec (18)
- # clojure-uk (182)
- # clojurescript (40)
- # community-development (5)
- # cursive (29)
- # datascript (6)
- # datomic (18)
- # duct (6)
- # emacs (4)
- # events (1)
- # fulcro (46)
- # hoplon (5)
- # jobs-discuss (12)
- # keechma (1)
- # luminus (7)
- # lumo (1)
- # off-topic (11)
- # onyx (9)
- # parinfer (5)
- # protorepl (1)
- # re-frame (18)
- # reagent (23)
- # reitit (2)
- # ring (5)
- # ring-swagger (20)
- # schema (1)
- # shadow-cljs (32)
- # spacemacs (1)
- # specter (2)
- # vim (26)
Hello, i have a problem with Compojure-Api it seems that is not generating valid Swagger 2 specs. Why compojure-api generate oneOf tags when is not in the spec of swagger 2?
What is the spec for a formData parameter name. I want to use foo/bar
, but the UI truncates it to bar
only when I use :foo/bar
in the Schema spec
I might be using stuff wrongly, but I get an assertion-error when using spec-coercions with compojure-api.
(defn nested-key [n k]
#_ (assert (qualified-keyword? n) (str "spec must have a qualified name" n))
(keyword (str (namespace n) "$" (name n)
(if-let [kns (namespace k)]
(str "$" kns)) "/" (name k))))
The offending line (which is commented out over) was added in https://github.com/metosin/spec-tools/commit/1a8dd077c254563367be5ec2ca9b40a561b59421#diff-a7972339bb0aba07594a0747da1a3c12
If there is any interest, I can dig deeper and try to figure out a minimal example to reproduce this.
I'm working on the backend-team, using spec, so we're quite happy writing out specs and maps with lisp-case
keys, as
Now, our frontend team are not too fond of lisp-case
, so before sending this off to the frontend, we camelCase
it, as such
So when using compojure-api with spec-coercion, the swagger docs say that we're returning {"foo-bar-baz": "qix}
, when in reality we return {"fooBarBaz" : "qix"}
.
the first one, I’m 99% sure that the SpecCoercion uses gensym
to generate names for the anonymous specs, and after the change, keyword is required.
something like:
(defn- ensure-name [?name]
(or ?name (keyword "" (name (gensym "spec")))))
should help.the second, I don’t think there is easy way. But you can do it by modifying the response from the swagger-docs endpoint… if you remove the swagger definitions from the api
and mound swagger-docs
manually, you can wrap the docs with a custom middleware that transforms the models with walk
etc.