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

Fix support ref schemas as vector forms in a registry #848

Closed
wants to merge 1 commit into from

Conversation

dvingo
Copy link
Contributor

@dvingo dvingo commented Feb 8, 2023

Addresses #847

Unwrap schemas in vector form for subsequent schema lookups.

@ikitommi
Copy link
Member

ikitommi commented Feb 8, 2023

This doesn't look correct:

(let [opts {:registry {:map (m/-map-schema)
                       :int (m/-int-schema)
                       ::test :map
                       ::test-2 [:map [:x :int]]}}]
  (m/schema [::test-2] opts)) ;=> :map

@ikitommi
Copy link
Member

ikitommi commented Feb 8, 2023

I don't think it should be ok to use the vector syntax in the first position (a schema type), e.g. this doesn't make much sense:

(let [opts {:registry {:map (m/-map-schema)
                       :int (m/-int-schema)
                       ::test :map
                       ::test-2 [:map [:x :int]]}}]
  (m/schema [::test-2 {:kikka "kukka"}] opts))

;; ... that would be:

[[:map [:x :int]] {:kikka "kukka"}]

@dvingo
Copy link
Contributor Author

dvingo commented Feb 8, 2023

ahh, thanks for the feedback! I understand now and agree doing this will lead to other problems, I can use other strategies to get the behavior I want.

@dvingo dvingo closed this Feb 8, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants