Skip to content

Commit 99fb7e1

Browse files
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 <[email protected]>
1 parent 3743b97 commit 99fb7e1

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

prompts/aspnet-minimal-api-openapi.prompt.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,21 @@ Your goal is to help me create well-structured ASP.NET Minimal API endpoints wit
2222
- Use record types for immutable request/response objects
2323
- Use meaningful property names that align with API design standards
2424
- Apply `[Required]` and other validation attributes to enforce constraints
25+
- Use the ProblemDetailsService and StatusCodePages to get standard error responses
2526

2627
## Type Handling
2728

2829
- Use strongly-typed route parameters with explicit type binding
29-
- Apply proper parameter binding with `[FromBody]`, `[FromRoute]`, `[FromQuery]`
3030
- Use `Results<T1, T2>` to represent multiple response types
3131
- Return `TypedResults` instead of `Results` for strongly-typed responses
3232
- Leverage C# 10+ features like nullable annotations and init-only properties
3333

34-
## OpenAPI / Swagger Documentation
34+
## OpenAPI Documentation
3535

36-
- Add explicit OpenAPI operation details with `.WithOpenApi()`
36+
- Use the built-in OpenAPI document support added in .NET 9
3737
- Define operation summary and description
38-
- Document response types with `.Produces<T>(statusCode)`
39-
- Document request bodies with `.WithRequestBody()`
38+
- Add operationIds using the `WithName` extension method
39+
- Add descriptions to properties and parameters with `[Description()]`
4040
- Set proper content types for requests and responses
41-
- Include examples using `SwaggerRequestExampleAttribute`
42-
- Document authentication requirements with `.RequireAuthorization()`
43-
- Use XML documentation comments for descriptive API documentation
41+
- Use document transformers to add elements like servers, tags, and security schemes
42+
- Use schema transformers to apply customizations to OpenAPI schemas

0 commit comments

Comments
 (0)