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

Generate JSON Schemas from clojure.specs #4

Closed
ikitommi opened this issue Oct 7, 2016 · 9 comments
Closed

Generate JSON Schemas from clojure.specs #4

ikitommi opened this issue Oct 7, 2016 · 9 comments

Comments

@ikitommi
Copy link
Member

ikitommi commented Oct 7, 2016

@miikka
Copy link
Contributor

miikka commented Oct 7, 2016

I didn't really understand what is the aim of the spec-parsing branch, but here's my sketch of this: miikka@8a52296

@miikka
Copy link
Contributor

miikka commented Oct 7, 2016

I looked at arohner/spectrum again and it might make sense to take my tests and write a version based on spectrum against them.

@ikitommi
Copy link
Member Author

Sketch looks great. Let's merge that in?

@miikka
Copy link
Contributor

miikka commented Nov 17, 2016

I have some some new code, but unfortunately right now the predicates for collection specs aren't resolved by the clojure.spec macros. This prevents spec-tools.json-schema from recognizing them. Hopefully it's fixed soon, the bug is here: CLJ-2035.

@ikitommi
Copy link
Member Author

Nice.

Is it possible to configure how the JSON Schema generation process works? For example, the Swagger JSON Schema doesn't currently allow nulls, any-of or one-ofs.

@miikka
Copy link
Contributor

miikka commented Nov 30, 2016

Progress report: as of #13, the ::person example from README can be converted into reasonable JSON Schema. CLJ-2035 is still open, but it can be worked around by fully qualifying the predicates when writing the specs.

I'm not sure what should be done w.r.t. Swagger - maybe spec-tools should only target the Swagger-compliant JSON Schema, since that's probably the main use case anyway - or maybe it should be somehow configurable, or maybe there should a separate function for that.

@ikitommi
Copy link
Member Author

ikitommi commented Dec 4, 2016

Awesome! I think both are valid cases in the future: swagger & pure json schema. Looking forward to see / hear how these should be separated. Also, we should be able to collect all map-specs from a nested definition and optionally convert to $refs for better reuse. I have a use case for "collect ALL registered referenced specs", so that should be doable too.

@ikitommi
Copy link
Member Author

s/merge is the last to be implemented.

@ikitommi
Copy link
Member Author

ikitommi commented May 4, 2017

done!

@ikitommi ikitommi closed this as completed May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants