Better JSON Schema generation for s/tuple
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 606
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
related: https://github.com/metosin/compojure-api/issues/327
As Swagger doesn't support heterogeneous lists, the current implementation converts to "array of anything" (with full info as vendor extension), which renders poorly on the UI. If all the tuple-elements are of same type, we could use that as the type. Also, as it could set the :minItems and :maxItems to the number of the elements in the tuple.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/spec_tools/swagger/core.cljc, especially the tuple handling referenced around lines 44-48, and compare it with the related compojure-api issue. The work is done when same-type tuple elements produce a useful array schema with minItems and maxItems set to the tuple length, while heterogeneous tuples retain their existing representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100