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

visitor/visit doesn't seem to work on merged specs #123

Open
polvoblanco opened this issue Jun 25, 2018 · 3 comments
Open

visitor/visit doesn't seem to work on merged specs #123

polvoblanco opened this issue Jun 25, 2018 · 3 comments

Comments

@polvoblanco
Copy link

polvoblanco commented Jun 25, 2018

Hi,

I have some specs created at run-time from databased maps of required and optional Data Specs (persisted as strings and read in as edn). However, when I try and visit specs created by merging these two sets of keys (to get the full spec) it returns an empty map.

e.g.
[metosin/spec-tools "0.7.0"]

(require '[spec-tools.core :as st]
               '[spec-tools.data-spec :as ds]
               '[spec-tools.visitor :as visitor])

(visitor/visit
   (st/merge (ds/spec {:spec {:required/str string?}})
             (ds/spec {:spec {:optional/str string?}
                       :keys-default ds/opt}))
   (visitor/spec-collector))

Returns {}

The un-merged specs visit as expected, but when merged together they don't seem to work.

Thanks,

Paul

@ikitommi ikitommi added the bug label Jun 27, 2018
@ikitommi
Copy link
Member

Sounds like a bug. I think spec-tools.core/merge doesn't have a dispatch value for visit-spec. PR welcome to fix this.

@slipset
Copy link
Contributor

slipset commented Mar 19, 2019

#173 is a duplicate of this issue, but has a PR (#174)

ikitommi added a commit that referenced this issue May 8, 2019
NOTE: uses `eval`. Is this safe?
@miikka
Copy link
Contributor

miikka commented May 6, 2020

Just to clarify: #173 is not a duplicate of this issue and merging data-spec still does not work.

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

No branches or pull requests

4 participants