Skip to content
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

Support native AoT with SwaggerUI #2800

Merged
merged 5 commits into from May 12, 2024

Conversation

martincostello
Copy link
Collaborator

Add support for using SwaggerUI with native AoT.

SwaggerGen still does not support native AoT, though it happens to work for simple cases from testing the sample app locally.

Resolves #2550.

Depends on #2799.

@martincostello martincostello added aot Relates to native AoT support bug fix labels Apr 14, 2024
@martincostello martincostello changed the title Aot support Support native AoT with SwaggerUI Apr 14, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 14, 2024

Codecov Report

Attention: Patch coverage is 87.03704% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 86.00%. Comparing base (0aac77e) to head (c4b2f04).

Files Patch % Lines
...aggerUI/JavascriptStringEnumEnumerableConverter.cs 71.42% 6 Missing ⚠️
...buckle.AspNetCore.SwaggerUI/SwaggerUIMiddleware.cs 94.44% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2800      +/-   ##
==========================================
- Coverage   90.33%   86.00%   -4.34%     
==========================================
  Files          73       75       +2     
  Lines        2795     2829      +34     
  Branches      449      459      +10     
==========================================
- Hits         2525     2433      -92     
- Misses        270      396     +126     
Flag Coverage Δ
Linux 86.00% <87.03%> (-0.09%) ⬇️
Windows 86.00% <87.03%> (-1.05%) ⬇️
macOS 86.00% <87.03%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Collaborator

@mesMess mesMess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Targeting frameworks for AoT and .NET 8 support
Wrapped using contexts (using)
Method cleanup
Other changes

Add WeatherForecast .NET 8 Minimal API test application.
Resolves domaindrivendev#2791.
Add support for using SwaggerUI with native AoT.
SwaggerGen still does not support native AoT, though it happens to work for simple cases.
Resolves domaindrivendev#2550.
Pass the `Type` value to `JsonSerializer` to give a hint as to how to serialize the value.
See domaindrivendev#2593 (comment).
Fix rebase.
Fix bad merge.
@martincostello martincostello marked this pull request as ready for review May 12, 2024 07:19
@martincostello martincostello enabled auto-merge (squash) May 12, 2024 07:21
@martincostello martincostello merged commit 61d890c into domaindrivendev:master May 12, 2024
9 checks passed
@martincostello martincostello deleted the aot-support branch May 12, 2024 07:25
gritcsenko added a commit to gritcsenko/HomeInventory that referenced this pull request May 15, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[Swashbuckle.AspNetCore](https://togithub.com/domaindrivendev/Swashbuckle.AspNetCore)
| `6.5.0` -> `6.6.1` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/Swashbuckle.AspNetCore/6.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/Swashbuckle.AspNetCore/6.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/Swashbuckle.AspNetCore/6.5.0/6.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Swashbuckle.AspNetCore/6.5.0/6.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>domaindrivendev/Swashbuckle.AspNetCore
(Swashbuckle.AspNetCore)</summary>

###
[`v6.6.1`](https://togithub.com/domaindrivendev/Swashbuckle.AspNetCore/releases/tag/v6.6.1)

##### What's Changed

- Modernise build and migrate to GitHub Actions for CI by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2775
- Update Redoc spelling in docs by
[@&#8203;Quppa](https://togithub.com/Quppa) in
[domaindrivendev/Swashbuckle.AspNetCore#2568
- C# 9 Record - Read example/summary from positional record by
[@&#8203;pixellos](https://togithub.com/pixellos) in
[domaindrivendev/Swashbuckle.AspNetCore#2546
- Grammatical correction of some comments by
[@&#8203;mokarchi](https://togithub.com/mokarchi) in
[domaindrivendev/Swashbuckle.AspNetCore#2768
- Update README.md for nested types custom schemaId support by
[@&#8203;antmeehan](https://togithub.com/antmeehan) in
[domaindrivendev/Swashbuckle.AspNetCore#2746
- Add support for `WithSummary` and `WithDescription` metadata by
[@&#8203;hwoodiwiss](https://togithub.com/hwoodiwiss) in
[domaindrivendev/Swashbuckle.AspNetCore#2414
- Update README.md - Fix `Add Security Definitions and Requirements for
Bearer auth` URL by [@&#8203;Saibamen](https://togithub.com/Saibamen) in
[domaindrivendev/Swashbuckle.AspNetCore#2705
- Replace <see href="link">text</see> with Markdown link format by
[@&#8203;mburumaxwell](https://togithub.com/mburumaxwell) in
[domaindrivendev/Swashbuckle.AspNetCore#2392
- Add support for required keyword by
[@&#8203;keahpeters](https://togithub.com/keahpeters) in
[domaindrivendev/Swashbuckle.AspNetCore#2810
- Resolves
[#&#8203;2717](https://togithub.com/domaindrivendev/Swashbuckle.AspNetCore/issues/2717)
by [@&#8203;MerickOWA](https://togithub.com/MerickOWA) in
[domaindrivendev/Swashbuckle.AspNetCore#2718
- Observe the route template constraints in the Swagger middleware by
[@&#8203;0xced](https://togithub.com/0xced) in
[domaindrivendev/Swashbuckle.AspNetCore#2418
- Added Swashbuckle.AspNetCore.Annotations.SwaggerIgnoreAttribute by
[@&#8203;jcracknell](https://togithub.com/jcracknell) in
[domaindrivendev/Swashbuckle.AspNetCore#2610
- Fix schema generation with allOf inheritance by
[@&#8203;bkoelman](https://togithub.com/bkoelman) in
[domaindrivendev/Swashbuckle.AspNetCore#2815
- avoid triple enumeration of formParameters by
[@&#8203;SimonCropp](https://togithub.com/SimonCropp) in
[domaindrivendev/Swashbuckle.AspNetCore#2823
- reduce some linq allocation by
[@&#8203;SimonCropp](https://togithub.com/SimonCropp) in
[domaindrivendev/Swashbuckle.AspNetCore#2819
- remove some duplicate dictionary lookups by
[@&#8203;SimonCropp](https://togithub.com/SimonCropp) in
[domaindrivendev/Swashbuckle.AspNetCore#2822
- remove redundant any check in InferRequestContentTypes by
[@&#8203;SimonCropp](https://togithub.com/SimonCropp) in
[domaindrivendev/Swashbuckle.AspNetCore#2824
- Correctly respect interfaces in `GetInheritanceChain` by
[@&#8203;angelaki](https://togithub.com/angelaki) in
[domaindrivendev/Swashbuckle.AspNetCore#2826
- Generate Enum-Dictionary-Keys (analogous to Newtonsoft) by
[@&#8203;angelaki](https://togithub.com/angelaki) in
[domaindrivendev/Swashbuckle.AspNetCore#2825
- Fix build badge by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2782
- Fix preview package versions by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2783
- Handle Stream and PipeReader content types correctly by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2784
- Add NuGet package READMEs by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2808
- Bump redoc to 2.1.3 by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2807
- Sort system usings first by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2790
- Throw if unsupported HTTP method used by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2797
- Fix configuration properties not being copied by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2796
- Add security policy by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2785
- Bump Microsoft.OpenApi by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2795
- Update to Swagger UI v5 by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2806
- Add customized document serialization support by
[@&#8203;remcolam](https://togithub.com/remcolam) in
[domaindrivendev/Swashbuckle.AspNetCore#2677
- Added documentation for ISwaggerDocumentSerializer by
[@&#8203;remcolam](https://togithub.com/remcolam) in
[domaindrivendev/Swashbuckle.AspNetCore#2837
- Fix flaky tests by locking on the statup type by
[@&#8203;remcolam](https://togithub.com/remcolam) in
[domaindrivendev/Swashbuckle.AspNetCore#2838
-
[#&#8203;2765](https://togithub.com/domaindrivendev/Swashbuckle.AspNetCore/issues/2765)
Allow Filter instance reuse by
[@&#8203;remcolam](https://togithub.com/remcolam) in
[domaindrivendev/Swashbuckle.AspNetCore#2839
- Throw an error when a user uses FromForm attribute with IFormFile in …
by [@&#8203;nikunjbhargava](https://togithub.com/nikunjbhargava) in
[domaindrivendev/Swashbuckle.AspNetCore#2840
- Filter illegal header fields by
[@&#8203;keahpeters](https://togithub.com/keahpeters) in
[domaindrivendev/Swashbuckle.AspNetCore#2842
- Fix handling of FileResult's with content types by
[@&#8203;IGx89](https://togithub.com/IGx89) in
[domaindrivendev/Swashbuckle.AspNetCore#2841
- Adding additional responses when 5XX errors are thrown. by
[@&#8203;say25](https://togithub.com/say25) in
[domaindrivendev/Swashbuckle.AspNetCore#2852
- Fix that XML comment examples do not show up if the type is string and
the example contains quotation marks by
[@&#8203;dldl-cmd](https://togithub.com/dldl-cmd) in
[domaindrivendev/Swashbuckle.AspNetCore#2727
- Exclude unused Swagger-UI files by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2851
- Fix RequestBodyFilters not being deep copied by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2850
- Avoid GitHub step summary file write conflicts by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2848
- Extend built-in supported types by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2804
- Update compatibility table by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2856
- Add GitHub issue and PR templates by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2788
- Fix stale permissions by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2855
- Add .NET 8 support by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2799
- Release automation workflows by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2809
- Support native AoT with SwaggerUI by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2800
- Bump some NuGet packages by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2868
- Fix stale permissions by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2863
- Attestation by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2869
- Add descriptions for more HTTP status codes by
[@&#8203;cremor](https://togithub.com/cremor) in
[domaindrivendev/Swashbuckle.AspNetCore#2872
- Only attest packages by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2870
- Fix tag version by
[@&#8203;martincostello](https://togithub.com/martincostello) in
[domaindrivendev/Swashbuckle.AspNetCore#2875

##### New Contributors

- [@&#8203;mokarchi](https://togithub.com/mokarchi) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2768
- [@&#8203;hwoodiwiss](https://togithub.com/hwoodiwiss) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2414
- [@&#8203;Saibamen](https://togithub.com/Saibamen) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2705
- [@&#8203;keahpeters](https://togithub.com/keahpeters) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2810
- [@&#8203;MerickOWA](https://togithub.com/MerickOWA) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2718
- [@&#8203;0xced](https://togithub.com/0xced) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2418
- [@&#8203;jcracknell](https://togithub.com/jcracknell) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2610
- [@&#8203;bkoelman](https://togithub.com/bkoelman) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2815
- [@&#8203;angelaki](https://togithub.com/angelaki) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2826
- [@&#8203;remcolam](https://togithub.com/remcolam) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2677
- [@&#8203;nikunjbhargava](https://togithub.com/nikunjbhargava) made
their first contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2840
- [@&#8203;IGx89](https://togithub.com/IGx89) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2841
- [@&#8203;dldl-cmd](https://togithub.com/dldl-cmd) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2727
- [@&#8203;cremor](https://togithub.com/cremor) made their first
contribution in
[domaindrivendev/Swashbuckle.AspNetCore#2872

**Full Changelog**:
domaindrivendev/Swashbuckle.AspNetCore@v6.5.0...v6.6.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/gritcsenko/HomeInventory).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjMuNSIsInVwZGF0ZWRJblZlciI6IjM3LjM2My41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aot Relates to native AoT support bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SwaggerUIMiddleware is broken when used with .NET Native AOT
3 participants