Update minimal API prompt for .NET 9 OpenAPI document generation (#6)
* Update minimal API prompt for .NET 9 OpenAPI document generation * Drop guidance on parameter binding attributes --------- Co-authored-by: Aaron Powell <me@aaron-powell.com>
This commit is contained in:
parent
3743b97a1c
commit
99fb7e177e
@ -22,22 +22,21 @@ Your goal is to help me create well-structured ASP.NET Minimal API endpoints wit
|
|||||||
- Use record types for immutable request/response objects
|
- Use record types for immutable request/response objects
|
||||||
- Use meaningful property names that align with API design standards
|
- Use meaningful property names that align with API design standards
|
||||||
- Apply `[Required]` and other validation attributes to enforce constraints
|
- Apply `[Required]` and other validation attributes to enforce constraints
|
||||||
|
- Use the ProblemDetailsService and StatusCodePages to get standard error responses
|
||||||
|
|
||||||
## Type Handling
|
## Type Handling
|
||||||
|
|
||||||
- Use strongly-typed route parameters with explicit type binding
|
- Use strongly-typed route parameters with explicit type binding
|
||||||
- Apply proper parameter binding with `[FromBody]`, `[FromRoute]`, `[FromQuery]`
|
|
||||||
- Use `Results<T1, T2>` to represent multiple response types
|
- Use `Results<T1, T2>` to represent multiple response types
|
||||||
- Return `TypedResults` instead of `Results` for strongly-typed responses
|
- Return `TypedResults` instead of `Results` for strongly-typed responses
|
||||||
- Leverage C# 10+ features like nullable annotations and init-only properties
|
- 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
|
- Define operation summary and description
|
||||||
- Document response types with `.Produces<T>(statusCode)`
|
- Add operationIds using the `WithName` extension method
|
||||||
- Document request bodies with `.WithRequestBody()`
|
- Add descriptions to properties and parameters with `[Description()]`
|
||||||
- Set proper content types for requests and responses
|
- Set proper content types for requests and responses
|
||||||
- Include examples using `SwaggerRequestExampleAttribute`
|
- Use document transformers to add elements like servers, tags, and security schemes
|
||||||
- Document authentication requirements with `.RequireAuthorization()`
|
- Use schema transformers to apply customizations to OpenAPI schemas
|
||||||
- Use XML documentation comments for descriptive API documentation
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user