You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to redefine spec-tools.visitor/visit for my custom spec to change how spec is shown in Swagger UI. E.g. I have closed-keys custom spec, but want to visit it as s/keys, so that Swagger UI generates appropriate model examples from my spec.
Now, it can be cumbersome to parse the custom spec form to implement its visiting. So I want instead to rely on the metadata attached to the spec form (such easy to use metadata can be conveniently generated by closed-keys macro). I.e.:
My current workaround is to attach metadata to the first symbol in the form instead of the whole form. Also in another case I just parse the form instead of relying on its metadata.
Interestingly, the issue is not reproducible when custom spec is "wrapped" by some other spec, specifically (s/coll-of ::my-spec) doesn't seem to have a problem.
The text was updated successfully, but these errors were encountered:
I suspect this has something to do with compojure.api.coercion.spec/Specify wrapping the spec into a spec record with spec-tools.core/create-spec, but I'm not sure why that would cause problems.
Library Version(s)
2.0.0-alpha29
Problem
I need to redefine
spec-tools.visitor/visit
for my custom spec to change how spec is shown in Swagger UI. E.g. I haveclosed-keys
custom spec, but want to visit it ass/keys
, so that Swagger UI generates appropriate model examples from my spec.Now, it can be cumbersome to parse the custom spec form to implement its visiting. So I want instead to rely on the metadata attached to the spec form (such easy to use metadata can be conveniently generated by
closed-keys
macro). I.e.:But this currently doesn't work because
(meta form)
is alwaysnil
in this function.I only managed to trace it back to
spec-tools.visitor/visit
function: it seems to get already crooked spec with no metadata in its form.The issue is reproducible for custom specs used in
:return
and:body
. I didn't test other places.Steps:
Expected:
Actual:
Workaround:
My current workaround is to attach metadata to the first symbol in the form instead of the whole form. Also in another case I just parse the form instead of relying on its metadata.
Interestingly, the issue is not reproducible when custom spec is "wrapped" by some other spec, specifically
(s/coll-of ::my-spec)
doesn't seem to have a problem.The text was updated successfully, but these errors were encountered: