Skip to content

OpenAPI: Show custom endpoints, fix content negotiation #1747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2025

Conversation

bkoelman
Copy link
Member

@bkoelman bkoelman commented Jul 28, 2025

This PR adds support for non-JSON:API endpoints (both Controllers and Minimal API endpoints), which now show up in SwaggerUI and generated clients. Custom action methods in JSON:API controllers are still hidden; a warning is logged now. It's currently unclear how that's supposed to work; please let us know what you expect from that by opening a new issue.

For JSON:API endpoints, the code that adds produces/consumes metadata was refactored, so it no longer influences ASP.NET routing. This fixes the bug where adding services.AddOpenApiForJsonApi() to your project changed the required media type for all requests.

Closes #1729.

QUALITY CHECKLIST

@bkoelman bkoelman changed the title OpenAPI: Support custom endpoints, fix content negotiation OpenAPI: Show custom endpoints, fix content negotiation Jul 28, 2025
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

❌ Patch coverage is 96.39175% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.78%. Comparing base (8c59d1b) to head (07b69d6).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...uckle/JsonApiActionDescriptorCollectionProvider.cs 95.77% 2 Missing and 7 partials ⚠️
...JsonApiMetadata/JsonApiEndpointMetadataProvider.cs 90.90% 1 Missing and 1 partial ⚠️
....OpenApi.Swashbuckle/OpenApiContentTypeProvider.cs 87.50% 1 Missing and 1 partial ⚠️
...onApiMetadata/ActionMethods/JsonApiActionMethod.cs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1747      +/-   ##
==========================================
+ Coverage   90.75%   90.78%   +0.02%     
==========================================
  Files         468      474       +6     
  Lines       14662    14697      +35     
  Branches     2315     2319       +4     
==========================================
+ Hits        13306    13342      +36     
- Misses        920      921       +1     
+ Partials      436      434       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…warning for non-standard JSON:API action methods; fix broken content negotiation.
@bkoelman bkoelman force-pushed the openapi-non-jsonapi-controllers branch from eabf07f to 07b69d6 Compare August 1, 2025 08:53
@bkoelman bkoelman marked this pull request as ready for review August 1, 2025 09:34
@bkoelman bkoelman merged commit e380c56 into master Aug 1, 2025
16 checks passed
@bkoelman bkoelman deleted the openapi-non-jsonapi-controllers branch August 1, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

OpenAPI: Previously used application/vnd.api+json returns 415 - Unsupported Media Type
1 participant