metosin / metosin/spec-tools

Better JSON Schema generation for s/tuple

Open
#71 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
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

https://github.com/metosin/spec-tools/blob/5b4f7a8891f71ef93051ef74023e4465e504493e/src/spec_tools/swagger/core.cljc#L44-L48

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.