metosin / metosin/spec-tools

Specs with dynamically resolved `set` fail to transform

Open
#283 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
606
Forks
90
PR merge metrics
No merged PRs in 30d

Description

(json-schema/transform (set (keys {:a 1 :b 2})))
=> {:enum [:b :a]}

(s/def ::available-actions (set (keys {:a 1 :b 2})))
=> :dev/available-actions

(json-schema/transform ::available-actions)
=> {}

The problems seem to be that visitor/spec-dispatch returns clojure.core/set and there's no visit-spec method for that so that a :default is used. And it never reaches the actual form resolution.

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 by tracing visitor/spec-dispatch and the visit-spec handling described in the issue, then reproduce the two dynamically resolved set examples with json-schema/transform. Done means both direct and registered specs resolve the set form and produce the expected enum rather than an empty schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
tooling
Issue type
Bug
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.