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

[Actix] Type definition overriden when struct used with same name multiple times #357

Closed
TobiasDeBruijn opened this issue Nov 11, 2021 · 0 comments · Fixed by #373
Closed

Comments

@TobiasDeBruijn
Copy link
Contributor

Hey there,

Thanks for all the hard work on Paperclip. I'm using it together with Actix to generate a spec for my API, however I've noticed something odd. Almost every request handler (split out into modules) has a Request and Response struct, for the request and response respectively. However it seems to be only provided once in the final spec.

Assume I have the following two endpoints:

// foo.rs
#[derive(Deserialize, Apiv2Schema)]
pub struct Request {
    a: i32,
    b: i32
}
...

// bar.rs
#[derive(Deserialize, Apiv2Schema)]
pub struct Request {
    c: String,
    d: f64
}

Both API will show the same request struct, rather than foo having it's own, and bar having it's own

Potential solution

I think a potential solution would be to include the module in the definition name, that way you can never have overlap

Versions

actix: 3.3.2
paperclip: 0.6.1
rustc: 1.57.0-beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant