This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-17
Channels
- # adventofcode (76)
- # announcements (6)
- # beginners (103)
- # boot (28)
- # calva (128)
- # cider (48)
- # cljs-dev (40)
- # clojure (268)
- # clojure-austin (2)
- # clojure-dev (2)
- # clojure-europe (47)
- # clojure-italy (10)
- # clojure-nl (17)
- # clojure-spec (2)
- # clojure-uk (15)
- # clojurescript (45)
- # code-reviews (14)
- # cursive (5)
- # data-science (2)
- # datascript (1)
- # datomic (52)
- # duct (4)
- # emacs (2)
- # figwheel (1)
- # figwheel-main (4)
- # fulcro (13)
- # hyperfiddle (51)
- # leiningen (19)
- # nrepl (40)
- # off-topic (45)
- # pathom (3)
- # pedestal (28)
- # portkey (7)
- # re-frame (25)
- # reagent (76)
- # reitit (7)
- # shadow-cljs (92)
- # slack-help (3)
- # specter (5)
- # timbre (2)
- # tools-deps (39)
- # unrepl (1)
- # vim (13)
I'm using Spec to generate Swagger docs, following this example (https://github.com/metosin/reitit/blob/master/examples/ring-spec-swagger/src/example/server.clj). The Swagger UI "Example Value" for one of my responses isn't being generated the way I would expect. Here's the spec definiton:
(ns http.fail
(:require [clojure.spec.alpha :as s]
[http.fail.message :as message]))
(s/def ::message (s/keys :req-un [::message/short]
:opt-un [::message/full]))
(s/def ::type keyword?)
(s/def ::context map?)
(s/def ::response-body (s/keys :req-un [::message ::type]
:opt-un [::context]))
And the :responses
in the route definition:
{200 {:body {:url {:provided string?
:resolved-to string?}}}
409 {:body ::http.fail/response-body}}
But the Swagger UI only shows {}
for the example.So strange, I changed the definition to something else, then back, and now it looks correct:
{
"message": {
"short": "string",
"full": "string"
},
"type": "string",
"context": {}
}
Is it possible there's a caching error in the Swagger UI generation logic?@robert.mather.rmm the ui doesn't show the optional keys, but if you look at the generated swagger JSON file, they are defined there (the list of mandatory keys).
👍 4