Fork me on GitHub

I'm using Spec to generate Swagger docs, following this example ( The Swagger UI "Example Value" for one of my responses isn't being generated the way I would expect. Here's the spec definiton:

  (:require [clojure.spec.alpha :as s]
            [ :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}}
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?


Also, I guess it doesn't do anything special with optional keys at this level?


@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

not sure about the caching at the UI.


I think the model tab shows the optional keys?


also, I think the form editor shows 'em (there is an ui option to generate html forms out of bodies)