[Rust][client] Partly fix bug #16974 - add missing imports#17503
Draft
j-szulc wants to merge 2 commits intoOpenAPITools:masterfrom
Draft
[Rust][client] Partly fix bug #16974 - add missing imports#17503j-szulc wants to merge 2 commits intoOpenAPITools:masterfrom
j-szulc wants to merge 2 commits intoOpenAPITools:masterfrom
Conversation
6 tasks
DDtKey
reviewed
Feb 26, 2024
Comment on lines
+5
to
+6
| use crate::apis::ResponseContent;{{#operations}}{{#operation}}{{#allParams}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}} | ||
| use crate::models::{{{dataType}}};{{/isContainer}}{{/isPrimitiveType}}{{/isUuid}}{{/isString}}{{/allParams}}{{/operation}}{{/operations}} |
Contributor
There was a problem hiding this comment.
I think the issue not imports itself, clients use clarified path to models, i.e models::MyStruct. Usually there is no need for explicit imports here.
This change creates a lot of extra imports, for example affected apis by this PR - worked fine even before, but check/clippy will highlight that there are extra clarified paths.
Moreover imports not unique, eg:
I think the issue is this condition: {{#isBodyParam}}models::{{/isBodyParam}} (e.g https://github.com/OpenAPITools/openapi-generator/blob/a8efb8eea8a8136311db2fa4dfea6df39d1c3d4a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache#L93C483-L93C523)
So we have 2 questions:
- why it's not
truefor these models? - for
hyperwe don't use this condition and it seems to work
UPD: I've submitted this PR: #17968
5 tasks
This file contains hidden or 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
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.
Note: this PR is not complete as there are issues I cannot do on my own (see below), hence draft PR.
It partly fixes the related issue #16974.
This PR simply adds a line to the top of
*_api.rsimporting the models used as arguments of the endpoint functions.The issue is that:
As Mustache is a logic-less template engine, to filter out a unique list of models requires delving into the enormous Java codebase of this project, which I can't do.
Mentioning technical committee per PR checklist: @jacob-pro
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming 7.1.0 minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)