Add support for async filters#2938
Conversation
|
Hi @martincostello, Thanks for taking over maintainership of the project ❤️. Is there a way for me to trigger the checks? |
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/IDocumentFilter.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/IOperationFilter.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/IParameterFilter.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/IRequestBodyFilter.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGeneratorOptions.cs
Outdated
Show resolved
Hide resolved
test/Swashbuckle.AspNetCore.SwaggerGen.Test/SwaggerGenerator/SwaggerGeneratorAsyncTests.cs
Outdated
Show resolved
Hide resolved
No, it's a built-in feature of GitHub Actions for first time contributors to a repo - someone with write access needs to approve them to run until your first contribution is merged. |
4823ccc to
a328799
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2938 +/- ##
==========================================
+ Coverage 90.13% 90.43% +0.29%
==========================================
Files 72 72
Lines 2736 2832 +96
Branches 433 443 +10
==========================================
+ Hits 2466 2561 +95
- Misses 270 271 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
@martincostello The tests are now green :) Let me know if you want any further changes. |
|
Thanks - I'll take a look at this in more detail tomorrow 👍 |
|
@martincostello Hi, have you had chance to look at it? |
|
Sorry, not yet, but it's on my TODO list. |
|
Hi @mauve - I checked out your pull request locally and had a look around the code. I've done some refactoring in this commit that aims to reduce the duplication in What are your thoughts on the approach? |
- Do not assume the `ISwaggerProvider` registration implements `IAsyncSwaggerProvider`. - Implement sync filters in terms of async operations. - Add CancellationToken parameter to async filters. - Make test filters also async. - Fix a number of analyser suggestions.
|
Great! Unsure what the process should be but I just cherry-picked your commit to the top of my PR. |
|
Thanks - I'll take a proper look at this again either later this afternoon, or more likely, tomorrow 👍 |
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGeneratorOptions.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGeneratorOptions.cs
Show resolved
Hide resolved
|
@martincostello I have removed the CancellationToken from GetSwaggerAsync, however I left them in the newly added interfaces so that we don't need to break that interface when we introduce CancellationToken again. |
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGeneratorOptions.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGeneratorOptions.cs
Show resolved
Hide resolved
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Adds async document, operation, parameter and request body filters.
Fixes: #1661