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

Swagger stackoverflow with recursive specs #75

Closed
ikitommi opened this issue Sep 14, 2017 · 2 comments · Fixed by #82
Closed

Swagger stackoverflow with recursive specs #75

ikitommi opened this issue Sep 14, 2017 · 2 comments · Fixed by #82

Comments

@ikitommi
Copy link
Member

copied from: metosin/compojure-api#339

---8<---
When I set the coercion to :spec and use a recursive spec like :

(s/def ::user nil?) ;; will be redefined below
(s/def ::name string)
(s/def ::parent (s/nilable ::user))
(s/def ::user (s/keys :req-un [::name ::parent]))

Swagger fail with this error:

{"type":"unknown-exception","class":"java.lang.StackOverflowError"}

It seems that the clojure.spec -> swagger conversion keep walking the recursive spec until the stack blows up.

@ikitommi ikitommi added the bug label Sep 14, 2017
@ikitommi
Copy link
Member Author

Currently, we haven't use schema references in JSON Schema or in Swagger JSON Schema. This is the reason to implement those. When it works, there could be a option how to generate the nested schemas:

a) inline 'em all (current)
b) only references
c) custom behaviour?

ikitommi added a commit that referenced this issue Oct 15, 2017
* fixes #75
* real fix would be to introduce a spec reference?
@ikitommi
Copy link
Member Author

There is a quick fix emerging in #82. Real fix would be to introduce a new SpecReference type for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant