CoreEx.AspNetCore.NSwag
4.0.0-preview-1
dotnet add package CoreEx.AspNetCore.NSwag --version 4.0.0-preview-1
NuGet\Install-Package CoreEx.AspNetCore.NSwag -Version 4.0.0-preview-1
<PackageReference Include="CoreEx.AspNetCore.NSwag" Version="4.0.0-preview-1" />
<PackageVersion Include="CoreEx.AspNetCore.NSwag" Version="4.0.0-preview-1" />
<PackageReference Include="CoreEx.AspNetCore.NSwag" />
paket add CoreEx.AspNetCore.NSwag --version 4.0.0-preview-1
#r "nuget: CoreEx.AspNetCore.NSwag, 4.0.0-preview-1"
#:package CoreEx.AspNetCore.NSwag@4.0.0-preview-1
#addin nuget:?package=CoreEx.AspNetCore.NSwag&version=4.0.0-preview-1&prerelease
#tool nuget:?package=CoreEx.AspNetCore.NSwag&version=4.0.0-preview-1&prerelease
CoreEx.AspNetCore.NSwag
Provides the NSwag
IOperationProcessorintegration that reads CoreEx MVC attributes ([Paging],[Query],[Accepts],[IdempotencyKey],[ProducesNotFoundProblem]) and injects the corresponding parameters, request bodies, and response entries into the generated OpenAPI specification.
Overview
CoreEx.AspNetCore.NSwag bridges CoreEx's declarative MVC attributes with NSwag's OpenAPI document generation pipeline. Without this package, NSwag cannot infer paging query-string parameters, idempotency-key request headers, or standard ProblemDetails error responses from CoreEx's attribute-based conventions.
NSwagOpenApiOperationProcessor is registered as a NSwag IOperationProcessor and runs once per operation during document generation. It reads endpoint metadata for each of the CoreEx MVC attributes and adds the corresponding OpenAPI artifacts — parameters, request-body content types, response entries — to the generated OpenApiOperation. The processor is controlled by OpenApiOptions (from CoreEx.AspNetCore), which exposes flags and display-text properties for every injected element.
CoreExNSwagExtensions.AddCoreExConfiguration() (on OpenApiDocumentGeneratorSettings) is the single registration call that wires both the operation processor and the CoreEx-aligned System.Text.Json schema settings.
Key capabilities
- 📋 Paging parameters: Reads
[PagingAttribute]and adds$skip,$take, and optionally$count/$pagequery-string parameters with descriptions controlled byOpenApiOptions.PagingSkipText,PagingTakeText, etc. - 🔍 Query parameters: Reads
[QueryAttribute]and adds$filterand/or$orderbyquery-string parameters whenSupportsFilter/SupportsOrderByare set. - 📦 Request body content types: Reads
[AcceptsAttribute]and populates the operationRequestBodywith the declared content type(s) and NSwag-inferred JSON schema for the body type. - 🔑 Idempotency-key header: Reads
[IdempotencyKeyAttribute]and adds anx-idempotency-keyheader parameter to the operation. - 🚫 Not-found response: Reads
[ProducesNotFoundProblemAttribute]and adds a404 application/problem+jsonresponse entry. - ⚠️ ProblemDetails responses: Optionally injects
application/problem+jsonresponse entries for the HTTP status codes configured viaOpenApiOptions.IncludeProblemDetailsHttpStatusCodes/OpenApiOptions.IncludeValidationProblemDetailsHttpStatusCodesand their corresponding status-code lists;500is only included when it is present in the configured list, not by default via a separateIncludeStandardProblemDetailsResponsesoption. - 📡 Fields query string: When
OpenApiOptions.IncludeFieldsRequestHeadersis set, adds the$fieldsquery-string parameter for response field projection. - 💬 Message response headers: When
OpenApiOptions.IncludeMessagesResponseHeadersis set, documentsx-messages-warningandx-messages-inforesponse headers. - ⚙️ STJ schema settings:
ConfigureSchemaSettings()aligns NSwag's JSON schema generation withJsonDefaults.SerializerOptions(camelCase, enum-as-string,WhenWritingDefault) so the generated schema matches the actual serialized output.
Key types
| Type | Description |
|---|---|
NSwagOpenApiOperationProcessor |
NSwag IOperationProcessor that reads CoreEx endpoint metadata and injects paging, query, accepts, idempotency-key, not-found, ProblemDetails, fields, and message-header artifacts into each OpenApiOperation. |
CoreExNSwagExtensions |
OpenApiDocumentGeneratorSettings extension methods: AddCoreExConfiguration() (registers processor + schema settings), AddOpenApiDocumentExtensions(configure?), ConfigureSchemaSettings(jsonSerializerOptions?). |
Related Namespaces
CoreEx.AspNetCore- DefinesOpenApiOptions(processor configuration), and the MVC attributes ([PagingAttribute],[QueryAttribute],[AcceptsAttribute],[IdempotencyKeyAttribute],[ProducesNotFoundProblemAttribute]) read by this processor.CoreEx.Http-HttpNamesprovides the configurable query-string and header name constants used when creating OpenAPI parameter names.CoreEx.Json-JsonDefaults.SerializerOptionsis the options instance applied to NSwag schema settings byConfigureSchemaSettings().
Additional Resources
- NSwag GitHub - The NSwag library this package extends.
AI Usage Guide
An AGENTS.md file is included with this package. AI coding assistants (GitHub Copilot, Claude, Cursor, etc.) that support workspace-injected package documentation will automatically surface concise usage guidance, code examples, and Do Not rules for this package without requiring a local CoreEx checkout.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CoreEx (>= 4.0.0-preview-1)
- CoreEx.AspNetCore (>= 4.0.0-preview-1)
- Microsoft.AspNetCore.OpenApi (>= 10.0.3)
- NSwag.AspNetCore (>= 14.6.2)
-
net8.0
- CoreEx (>= 4.0.0-preview-1)
- CoreEx.AspNetCore (>= 4.0.0-preview-1)
- Microsoft.AspNetCore.OpenApi (>= 8.0.24)
- NSwag.AspNetCore (>= 14.6.2)
-
net9.0
- CoreEx (>= 4.0.0-preview-1)
- CoreEx.AspNetCore (>= 4.0.0-preview-1)
- Microsoft.AspNetCore.OpenApi (>= 9.0.13)
- NSwag.AspNetCore (>= 14.6.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0-preview-1 | 50 | 6/20/2026 |