Skip to content

fix(openapi): skip wildcard servers and default problem schema to CoreProblemDetails - #15

Merged
FEDERIN merged 4 commits into
mainfrom
fix/skip-wildcard-development-servers
Nov 15, 2026
Merged

FEDERIN merged 4 commits into
mainfrom
fix/skip-wildcard-development-servers

Conversation

@FEDERIN

@FEDERIN FEDERIN commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes two problems that produced an invalid OpenAPI document for consumers of AddCoreOpenApi.

  1. Wildcard "Local" servers. In Development, every ASPNETCORE_URLS entry was published as a server. Container listen addresses such as http://+:8080 are binding patterns, not callable URLs. They are now skipped (+, *, 0.0.0.0, [::]).
  2. Dangling problem schema reference. ProblemResponses.SchemaId defaulted to ProblemDetails, a component the library never generates. Every problem response referenced it and failed to resolve. The default is now CoreProblemDetails, the problem type shipped by this library.

Behavior change

ProblemResponses.SchemaId now defaults to CoreProblemDetails, and ProblemSchemaIds includes it. Consumers that relied on the previous default must set SchemaId = "ProblemDetails" explicitly. The only known consumer (CoreSystem monorepo sample) is the sole user at the moment, so the impact is limited to it.

Test stability

OpenApiRegistrationTests and OpenApiRegistrationCoverageTests both write process-wide environment variables. They now share the ProcessEnvironment xUnit collection, which removes an intermittent failure caused by parallel execution.

Verification

  • dotnet build CoreSystem.OpenApi.slnx -c Release: 0 warnings, 0 errors.
  • dotnet test --solution CoreSystem.OpenApi.slnx -c Release: 168/168 on net8.0, net9.0 and net10.0, repeated five times.

In Development, AddCoreOpenApi appends every ASPNETCORE_URLS entry as a
"Local" server. Container listen addresses such as http://+:8080 are
binding patterns, not URLs a client can call, so they were published in
the document.

- Skip wildcard hosts (+, *, 0.0.0.0, [::]) when building Local servers.
- Document that ProblemResponses.SchemaId defaults to ProblemDetails and
  must name the error schema in use (for example CoreProblemDetails),
  otherwise the generated document contains dangling $ref entries.
The default ProblemResponses.SchemaId pointed to a ProblemDetails
component that the library does not generate, leaving every problem
response with a dangling $ref. CoreProblemDetails is the problem type
shipped by this library, so it is now the default, and it is recognized
as a problem schema by default as well.

Behavior change: consumers that relied on the previous default must set
SchemaId = "ProblemDetails" explicitly.
OpenApiRegistrationTests and OpenApiRegistrationCoverageTests both write
process-wide environment variables. Running them in parallel made the
Development server assertions intermittently fail. Place both classes in
the same xUnit collection so they run sequentially.
@FEDERIN FEDERIN changed the title fix(swashbuckle): skip wildcard listen addresses in Development servers fix(openapi): skip wildcard servers and default problem schema to CoreProblemDetails Nov 15, 2026
@FEDERIN
FEDERIN merged commit 2ea116e into main Nov 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant