Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with s/or coercion in body-params spec #424

Open
kjothen opened this issue Jul 16, 2019 · 1 comment
Open

Issue with s/or coercion in body-params spec #424

kjothen opened this issue Jul 16, 2019 · 1 comment
Labels
upstream-problem The problem is caused by a bug in a dependency.

Comments

@kjothen
Copy link

kjothen commented Jul 16, 2019

Library Version(s)

2.0.0-alpha30

Problem

Specs containing or fail on alternate cases - this was working in 2.0.0-alpha28. Of course, the swagger definition can only show one of the or alternatives only, but any request payload that conforms to the spec should (and did) work - could this behaviour be reverted back please?

eg. in the below, the definition of the linux-group would display in the swagger page, but body params containing the windows group would fail, eg {:group {:linux-id 1}} - succeeds, {:group {:windows-id "1"}} - fails.

(s/def ::linux-id int?)
(s/def ::linux-group (s/keys :req-un [::linux-id]))

(s/def ::windows-id string?)
(s/def ::windows-group (s/keys :req-un [::windows-id]))

(s/def ::group (s/or :group ::linux-group 
                               :group ::windows-group))

(api (swagger-routes (context "/group" [] :coercion :spec (resource {:post {:parameters {:body-params ::group}}}))))
@miikka miikka modified the milestone: 2.0.0 Nov 2, 2019
@miikka
Copy link
Contributor

miikka commented Nov 2, 2019

This is caused by a bug in spec-tools: metosin/spec-tools#178

@miikka miikka added the upstream-problem The problem is caused by a bug in a dependency. label Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream-problem The problem is caused by a bug in a dependency.
Projects
None yet
Development

No branches or pull requests

2 participants