-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[PM-6137] Fix invalid Swagger generation in knowndevice #3760
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3760 +/- ##
=======================================
Coverage 39.33% 39.34%
=======================================
Files 1040 1039 -1
Lines 51632 51630 -2
Branches 4613 4613
=======================================
Hits 20312 20312
+ Misses 30376 30374 -2
Partials 944 944 ☔ View full report in Codecov by Sentry. |
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.
LGTM. Seems weird that Swagger can't figure out [FromHeader]
on the request model and on each property within it though.
Yeah, been an open issue in Swashbuckle for a while domaindrivendev/Swashbuckle.AspNetCore#1938 Thankfully this is the only place where FromHeader is used this way. |
Thank you for linking the issue. Interesting stuff. |
No New Or Fixed Issues Found |
## Type of change ``` - [ ] Bug fix - [ ] New feature development - [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ``` ## Objective Update swagger generator to version 7.2.0, pull in the new templates and generate the new API crates. I've also updated the build instructions to use .NET 8, as is required in the latest server code. The version of the server code used to generate this is bitwarden/server@fc1d7c7 I've had to make some small modifications to the server code to get it working, ~~and I'll link the PR here shortly.~~ bitwarden/server#3760 To make this easier to review, I've split this into three commits: - b42f189: Update the swagger and dotnet versions, and pull in the new templates as-is. Note that this won't generate working code. - 9727d46: Patched the provided templates to make it work with our code. This is in a separate commit to make it easier to see what we've changed and hopefully make it easier in the future to update these templates. The changes are: - Ignore warnings by default - Use Uuids instead of strings - Use serde_repr to support int enums - Disabled default features for reqwest (to remove default tls) - Removing double optionals (This could be reverted once we're better at marking everything as required in the server) - ~~f9b63606477d0f0f987b8534ef6e6755c76003a2: New autogenerated swagger code, no manually edited files here.~~ Moved to a separate PR (#593)
Type of change
Objective
Using
[FromHeader]
without a header name on a request parameter generates an invalid Swagger schema, so we need to lift the parameters out of the class to make sure the generated schema is correct.