Update minimal API prompt for .NET 9 OpenAPI document generation

This commit is contained in:
Mike Kistler 2025-06-26 16:14:27 -07:00
parent 55bf8f8b3a
commit 2fea396736

View File

@ -20,6 +20,7 @@ Your goal is to help me create well-structured ASP.NET Minimal API endpoints wit
- Use record types for immutable request/response objects
- Use meaningful property names that align with API design standards
- Apply `[Required]` and other validation attributes to enforce constraints
- Use the ProblemDetailsService and StatusCodePages to get standard error responses
## Type Handling
@ -29,13 +30,12 @@ Your goal is to help me create well-structured ASP.NET Minimal API endpoints wit
- Return `TypedResults` instead of `Results` for strongly-typed responses
- Leverage C# 10+ features like nullable annotations and init-only properties
## OpenAPI / Swagger Documentation
## OpenAPI Documentation
- Add explicit OpenAPI operation details with `.WithOpenApi()`
- Use the built-in OpenAPI document support added in .NET 9
- Define operation summary and description
- Document response types with `.Produces<T>(statusCode)`
- Document request bodies with `.WithRequestBody()`
- Add operationIds using the `WithName` extension method
- Add descriptions to properties and parameters with `[Description()]`
- Set proper content types for requests and responses
- Include examples using `SwaggerRequestExampleAttribute`
- Document authentication requirements with `.RequireAuthorization()`
- Use XML documentation comments for descriptive API documentation
- Use document transformers to add elements like servers, tags, and security schemes
- Use schema transformers to apply customizations to OpenAPI schemas