NSwag for ASP.NET Core 14
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
3prompts
- C# 14106 lines · 4.4K tokens
- ASP.NET Core 10.065 lines · 3.5K tokens
- NSwag for ASP.NET Core 1459 lines · 3.1K tokens
Total230 lines · 11K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 257
- 295
- 307
- 312
- 319
- 323
- 327
- 338
- 352
- 362
- 367
- 378
- 426
- 434
- 488
- 502
- 524
- 525
- 532
- 552
- 601
- 611
- 613
- 614
- 636
- 639
- 674
- 759
- 770
- 772
- 775
- 778
- 798
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1275
- 1333
- 1385
- 1395
Prompt Preview
Apply the ASP.NET Core 10.0 prompt first. These rules cover NSwag.AspNetCore 14 with NJsonSchema 11 on .NET 10, including document generation, middleware, browser UIs, and accompanying code-generation tools. Keep the application and build tools on supported .NET 10 servicing updates and align the NSwag package and tool versions.
Document exposure and filtering
- Gate
UseOpenApi(),UseSwaggerUi(), andUseReDoc()behind an authorization check or a protected listener when descriptions are nonpublic. Cover raw JSON/YAML, UI redirects, index pages, and assets; authorization on controllers orMapControllers()does not attach a policy to these middleware paths. The default document path is/swagger/{documentName}/swagger.jsonand the UI path is/swagger. - Register a distinct
DocumentNameand explicit audience filter for each published contract.ApiGroupNamesbeing null or empty includes all API Explorer groups;{documentName}routes and the default Swagger UI can expose every registered document. Hiding a document from the UI dropdown does not protect its download route. - Insert an excluding
IOperationProcessorwithOperationProcessors.Insert(0, processor)so excluded operations do not first generate their DTO schemas. Review the final components and shared schemas for internal fields, and keep route authorization independent of API Explorer visibility or document filtering. - Put security requirements, audience filtering, and other publication rules in generator processors or the
PostProcessconfigured throughAddOpenApiDocument().PostProcess