-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prepare for OpenAPI.NET 3.0 #3647
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
Conversation
Cherry-pick some changes from #3646 to reduce the diff.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3647 +/- ##
=======================================
Coverage 94.75% 94.75%
=======================================
Files 110 110
Lines 3831 3834 +3
Branches 760 764 +4
=======================================
+ Hits 3630 3633 +3
Misses 201 201
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR prepares the codebase for OpenAPI.NET 3.0 by updating type instantiations and adding type checks to handle the transition from concrete types to interface types in the OpenAPI.NET library.
- Replaces target-typed
new()expressions with explicitnew OpenApiMediaType()in test and benchmark files - Adds type checks before accessing properties on dictionary values that may return interface types
- Updates package versions for test dependencies
- Changes explicit type declarations to
varin TryGetValue calls for consistency
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Swashbuckle.AspNetCore.SwaggerGen.Test/VerifyTests.cs | Updated test instantiations from target-typed new to explicit OpenApiMediaType constructor |
| test/Swashbuckle.AspNetCore.SwaggerGen.Test/SwaggerGenerator/SwaggerGeneratorTests.cs | Updated test instantiations from target-typed new to explicit OpenApiMediaType constructor |
| src/Swashbuckle.AspNetCore.SwaggerGen/XmlComments/XmlCommentsRequestBodyFilter.cs | Added type checks before casting Content dictionary values to concrete OpenApiMediaType |
| src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs | Added type checks and continue logic to safely handle interface types in Content dictionaries |
| src/Swashbuckle.AspNetCore.ApiTesting/ResponseValidator.cs | Changed explicit type to var in TryGetValue for consistency |
| src/Swashbuckle.AspNetCore.ApiTesting/RequestValidator.cs | Changed explicit type to var in TryGetValue for consistency |
| perf/Swashbuckle.AspNetCore.Benchmarks/XmlCommentsBenchmark.cs | Updated benchmark instantiation from target-typed new to explicit OpenApiMediaType constructor |
| Directory.Packages.props | Updated test dependency versions (MartinCostello.Logging.XUnit.v3, Microsoft.Playwright, Microsoft.NET.Test.Sdk, NSwag.MSBuild) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Cherry-pick some changes from #3646 to reduce the diff.