Skip to content

Augment TypeConverter to allow for ValueObjectOrError<T> #937

Description

@msalinas-a

Describe the feature

Currently TypeConverter uses __Deserialize which calls NormalizeInput, Validate and eventually ThrowWhenValidationFails. While this allows Vogen to work for ASP.NET, it means model binding will throw for invalid values, before validation can be done. This makes it very difficult to use in common scenarios.

Hooking into the ASP.NET validation pipeline would probably be too much, but it'd be nice if we could bind to ValueObjectOrError<T> for a no-throw model binding path.
This would also also allow one to create a ValidationAttribute that simply picks up the ValueObjectOrError<T>.Error property and adds it to the ModelStateDictionary if it's not Ok.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions