Skip to content

[Rust][client] Partly fix bug #16974 - add missing imports #17503

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

use reqwest;

use crate::apis::ResponseContent;
use crate::apis::ResponseContent;{{#operations}}{{#operation}}{{#allParams}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}
use crate::models::{{{dataType}}};{{/isContainer}}{{/isPrimitiveType}}{{/isUuid}}{{/isString}}{{/allParams}}{{/operation}}{{/operations}}
Comment on lines +5 to +6
Copy link
Contributor

@DDtKey DDtKey Feb 26, 2024

Choose a reason for hiding this comment

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

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:

  1. why it's not true for these models?
  2. for hyper we don't use this condition and it seems to work

UPD: I've submitted this PR: #17968

use super::{Error, configuration};

{{#operations}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Pet;
use crate::models::Pet;
use super::{Error, configuration};

/// struct for passing parameters to the method [`add_pet`]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Order;
use super::{Error, configuration};

/// struct for passing parameters to the method [`delete_order`]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::User;
use crate::models::User;
use super::{Error, configuration};

/// struct for passing parameters to the method [`create_user`]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Pet;
use crate::models::Pet;
use super::{Error, configuration};

/// struct for passing parameters to the method [`add_pet`]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Order;
use super::{Error, configuration};

/// struct for passing parameters to the method [`delete_order`]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::User;
use crate::models::User;
use super::{Error, configuration};

/// struct for passing parameters to the method [`create_user`]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Pet;
use crate::models::Pet;
use super::{Error, configuration};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Order;
use super::{Error, configuration};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::User;
use crate::models::User;
use super::{Error, configuration};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Pet;
use crate::models::Pet;
use super::{Error, configuration};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::Order;
use super::{Error, configuration};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use reqwest;

use crate::apis::ResponseContent;
use crate::models::User;
use crate::models::User;
use super::{Error, configuration};


Expand Down