Skip to content

Repository files navigation

Validations Source Generator

This repo contains code for an incremental source generator that generates code that validates parameters on a minimal endpoint and produces ProblemDetails if validations are not passed.

Usage/Examples

To opt-in to code generation for validations, invoke WithValidation on an endpoint that requires validation.

// Validating a single complex parameter
app.MapPost("/todo", (Todo todo) => todos.Add(todo))
    .WithValidation();

Running Tests

To run tests, run the following command inside the ValidationsGenerator.Tests directory:

dotnet test

To run the sample app for this generator, execute the following command in the samples/SampleApp directory:

dotnet run

License

MIT

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages