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

Support nested schemas in the :or type #55

Merged
merged 3 commits into from
Nov 2, 2020
Merged

Conversation

whatyouhide
Copy link
Collaborator

@whatyouhide whatyouhide commented Nov 2, 2020

@josevalim I completely overlooked nested schemas in #54. This to me seems like the best (= least horrible, still pretty ugly) way of dealing with them.

schema = [
  docs: [
    type: {:or, [:boolean, {:keyword_list, enabled: [type: :boolean]}]}
  ]
]

Thoughts?

@josevalim
Copy link
Member

This should also work:

schema = [
  docs: [
    type: {:or, [:boolean, keyword_list: [enabled: [type: :boolean]]]}
  ]
]

Is it better? Thoughts?

@whatyouhide
Copy link
Collaborator Author

@josevalim that's the same data structure, yeah, it works in the same way. Do you mean I should update the examples?

Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would update the examples as I find the keyword syntax more palatable but it is your call.

@whatyouhide whatyouhide merged commit 360e101 into master Nov 2, 2020
@whatyouhide whatyouhide deleted the nested-schemas-in-or branch November 2, 2020 11:06
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