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

[DISCUSSION] Per-claim optional processing #187

Open
victorolinasc opened this issue Aug 9, 2018 · 2 comments
Open

[DISCUSSION] Per-claim optional processing #187

victorolinasc opened this issue Aug 9, 2018 · 2 comments

Comments

@victorolinasc
Copy link
Collaborator

Joken configuration now has a Joken.Claim struct which has a :options field. This came from the #182 PR. We could add custom messages, skipping the claim if some condition match and whatnot.

Ideas are welcome here.

@ybod
Copy link

ybod commented Jan 16, 2019

There is two ways we can implement optional claims:

  • pass nil or :not_defined atom into the validation function if claim is not defined at all. In this case the validation function will decide on the outcome.

  • add an optional: [claim1, claim2...]parameter into the :options in case we do not want to fail if some claim is not defined at all, if this claim is defined it will be still validated

@victorolinasc
Copy link
Collaborator Author

On Joken 2 each claim might have its own options since now we use a "key" => %Joken.Claim{} config map. I think it is easier to add flags there. What do you say?

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

2 participants