Menu

Your Upgrade Passed Every Test. Your API Docs Still Broke.
📰

Your Upgrade Passed Every Test. Your API Docs Still Broke.

DEV Community: dotnet·Rituraj·3 days ago
#tEEITgY9
#devtodotnet#devto#dev#openapi#side
Reading 0:00
15s threshold

After moving a project to .NET 11, everything was green. Build, tests, app startup. Then the Swagger UI page refused to render.

The cause is one default. OpenApiOptions.OpenApiVersion now defaults to OpenAPI 3.2 instead of 3.1, so /openapi/v1.json starts with "openapi": "3.2.0" . The server returns 200 and logs nothing. The swagger-ui bundled in Swashbuckle.AspNetCore.SwaggerUI 10.1.4 and earlier only understands 3.0 and 3.1, so it gives up.

Your tests won't catch this, because the server isn't broken. The contract format changed, and the people who notice are your consumers: client generators, gateway imports, someone else's contract tests.

The full article covers:

three fixes: update the UI package, pin to 3.1, or serve a 3.2 and a 3.1 document side by side (plus the ShouldInclude line that side-by-side setup needs)

why pinning down to 3.0 swaps one breaking change for another

what breaks in custom document and schema transformers after the move to Microsoft.OpenApi 3.x

a five-minute test that fails…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.