joken icon indicating copy to clipboard operation
joken copied to clipboard

[DISCUSSION] Per-claim optional processing

Open victorolinasc opened this issue 6 years ago • 2 comments

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.

victorolinasc avatar Aug 09 '18 01:08 victorolinasc

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

ybod avatar Jan 16 '19 13:01 ybod

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?

victorolinasc avatar Jan 16 '19 13:01 victorolinasc