You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we can validate an Enumeration using sttp.tapir.Validator.Enumeration, I want to have a custom message for the invalid case.
Use case
For example, when we want to validate a list of enumeration inputs, if one of them fails the validation, the error message is too generic to specify which one is wrong.
Proposed solution
We can add an optional field to sttp.tapir.Validator.Enumeration as showMessageOpt: Option[T => String] to handle the error message.
Besides this approach, do we have any workaround? If not, I can help to implement this.
The text was updated successfully, but these errors were encountered:
For example, we have a field pets: List[Pet], and we already define an enum Pet = { Cat, Dog }.
If users pass in List(Dog, Lion), the error message is only "pets: Invalid", and I think "pets: Lion invalid" or something like that will be more explainable.
Currently, we implement the schema as: Schema[Pet]: Schema(ValidatorEnum[Pet]), then Schema[pets]: Schema[Pet].asIterable.
Feature request
Since we can validate an Enumeration using
sttp.tapir.Validator.Enumeration
, I want to have a custom message for the invalid case.Use case
For example, when we want to validate a list of enumeration inputs, if one of them fails the validation, the error message is too generic to specify which one is wrong.
Proposed solution
We can add an optional field to
sttp.tapir.Validator.Enumeration
asshowMessageOpt: Option[T => String]
to handle the error message.Besides this approach, do we have any workaround? If not, I can help to implement this.
The text was updated successfully, but these errors were encountered: