-
-
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
Remove description from OpenApiResponse when serializing for Swagger v2 #4314
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…v2 to prevent error "Structural error at paths.somepath.get.responses.304 should NOT have additional properties additionalProperty: description" [PR].
…v2 to prevent error "Structural error at paths.somepath.get.responses.304 should NOT have additional properties additionalProperty: description" [PR].
@RicoSuter can you review the remaining failing test case? Not sure what would be needed to fix it. |
Thx for the PR |
If I see it correctly. |
Had to revert as it breaks tests... |
shuruev
added a commit
to servicetitan/NSwag
that referenced
this pull request
Nov 16, 2023
* Update README.md * Add nswag.cmd (RicoSuter#4255) * v13.18.1 * v13.18.2 * Remove description from OpenApiResponse when serializing for Swagger v2 (RicoSuter#4314) * Remove description from OpenApiResponse when serializing for Swagger v2 to prevent error "Structural error at paths.somepath.get.responses.304 should NOT have additional properties additionalProperty: description" [PR]. * Remove description from OpenApiResponse when serializing for Swagger v2 to prevent error "Structural error at paths.somepath.get.responses.304 should NOT have additional properties additionalProperty: description" [PR]. * Add check for IsBindingAllowed so that BindNever attribute works correctly * Add CS0612 to the File.Header.liquid (RicoSuter#4409) OpenApi which contains deprecated schemas correctly generates `[Obsolete]` attribute. If the API document does not propagate `deprecate` all the way to path/method resulting c# code produce warning CS0612: '...' is obsolete * Update Client.Class.liquid (RicoSuter#4402) Fix Newtonsoft.Json being used instead of System.Text.Json * Descriptive exception for duplicate XML doc line (RicoSuter#2863) (RicoSuter#4388) Duplicate response code in XML documentation response xml tag causes somewhat hard to debug exception, which is now made more descriptive. Did not yet figure out how to make an unit test for this one or if some other other exception type would be more suitable than InvalidOperationException. Bug: Duplicate return code declaration causes nasty exception id: RicoSuter#2863 Co-authored-by: Antti Viita <antti.viita@vividworks.com> * Revert PR RicoSuter#4314 * v13.18.3 * Improve NRT support for API parameters * Required path parameters are not nullable (when NRT is off) * v13.18.4 * Add enforceNotNull parameter and use for required path parameters * v13.18.5 * Add File.Footer.liquid (RicoSuter#4411) * Swagger UI v4.18.3, closes RicoSuter#4311 and RicoSuter#4387 (v13.18.5) * add axios abort signal (RicoSuter#4282) * add axios abort signal * unit test * Add support for MSBuild transitive dependency flow RicoSuter#4026 (RicoSuter#4338) * Use GNU tar for cache and install .NET in single step (RicoSuter#4251) * Unwrap ValueTask<T> return types (RicoSuter#4374) * Unwrap ValueTask<T> return types, same as Task<T>, unwrap (Value)Task<ActionResult<T>> and unify unwrapping for consistency RicoSuter#4373 * lahma suggestion for performance * cleanup * NJsonSchema v10.9.0 * Fix build * Revert "Fix build" This reverts commit 21bf926. * Fix build * Fix dep * Add .NET 5 SDK * Improve build * v13.19.0 * fix default value docs of SerializeTypeInformation, closes RicoSuter#4480 * Add SwaggerRoutesFactory to SwaggerUi3Settings * Disable warning CS8604 "Possible null reference argument for parameter" in generated code (RicoSuter#4422) * Disable warning CS8604 "Possible null reference argument for parameter" in code generation file header template * Restore warning in file footer * Update Client.Class.liquid (RicoSuter#4471) * Update Client.Class.liquid fix RicoSuter#4466 * Update Client.Class.liquid --------- Co-authored-by: Rico Suter <mail@rsuter.com> * install .net 3.1 sdk * v13.20.0 * Set ChocolateyPush source * Post-merge adjustments * Updated more Newtonsoft.Json versions, for consistency --------- Co-authored-by: Rico Suter <mail@rsuter.com> Co-authored-by: Patrick Hofman <PatrickHofman@users.noreply.github.com> Co-authored-by: Jan Trejbal <jan@trejbal.land> Co-authored-by: Jean-Luc <jeanluc1@live.de> Co-authored-by: Antti Viita <aviita@gmail.com> Co-authored-by: Antti Viita <antti.viita@vividworks.com> Co-authored-by: Rico Suter <rico.suter@buhlergroup.com> Co-authored-by: Lydon Chandra <104476360+fmg-lydonchandra@users.noreply.github.com> Co-authored-by: Daniel Sack <danielthecoder@outlook.com> Co-authored-by: Marko Lahma <marko.lahma@gmail.com> Co-authored-by: Alasdair <alasdaircs@gmail.com> Co-authored-by: Noah Stolk <noah.stolk@gmail.com> Co-authored-by: Alireza Mahdavi <alireza.mahdavi2125@outlook.com>
lahma
pushed a commit
to lahma/NSwag
that referenced
this pull request
Jan 20, 2024
…v2 (RicoSuter#4314) * Remove description from OpenApiResponse when serializing for Swagger v2 to prevent error "Structural error at paths.somepath.get.responses.304 should NOT have additional properties additionalProperty: description" [PR]. * Remove description from OpenApiResponse when serializing for Swagger v2 to prevent error "Structural error at paths.somepath.get.responses.304 should NOT have additional properties additionalProperty: description" [PR].
lahma
pushed a commit
to lahma/NSwag
that referenced
this pull request
Jan 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove description from OpenApiResponse when serializing for Swagger v2 to prevent error "Structural error at paths.somepath.get.responses.304 should NOT have additional properties additionalProperty: description".
Because the C# specification of
OpenApiResponse
is adapted to comply with OpenAPI v3, the generation of Swagger v2 yields an invalid result. Specifically the "description" property ofOpenApiResponse
is not allowed with Swagger v2, but is always generated into the Swagger when callingToJson
.This commit fixes this bug by ignoring the description property at all, since it is invalid anyways.