Skip to content
Discussion options

You must be logged in to vote

Types are automatically gathered for validation by either being part of the Map* method (e.g. MapGet([Required] string s)) or by having the [ValidatableType] attribute on the type and the source generator running. Validation then runs as an EndpointFilter automatically by the framework.

When you say arbitrary objects, if it's in the context of ASP.NET Core, then use [ValidatableType]. If you're talking about a console app, or custom logic outside of a minimal endpoint, then you'd need to do a bit more work of registering IValidatableInfoResolver's and calling validation yourself. Here is an example where I was playing around with calling validation myself on Hub Methods: d803d95#diff-5ebd…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Ducki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants