Fork me on GitHub
#ring-swagger
<
2017-08-23
>
daveliepmann14:08:37

It appears that defining a schema using if prevents it from being shown in Swagger's "example value"—is there a known workaround?

daveliepmann14:08:15

How would one successfully get a description and sample value out of this conditional schema?

juhoteperi14:08:33

@daveliepmann (describe (s/if? string? (s/pred valid-uuid?) schema/Uuid) "unique ID" :default "foobar") or (field (s/if? string? (s/pred valid-uuid?) schema/Uuid) {:description "unique ID" :default "foobar"}) (I'd use the latter, to avoid kwargs)

daveliepmann15:08:19

Thanks for the help @juhoteperi:default works great: (sugar/describe (schema/if string? (schema/pred valid-uuid?) schema/Uuid) "unique ID" :default "unique ID")