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

Models often use Option<Box<...>> #6

Open
jannic opened this issue Jan 21, 2023 · 2 comments
Open

Models often use Option<Box<...>> #6

jannic opened this issue Jan 21, 2023 · 2 comments

Comments

@jannic
Copy link

jannic commented Jan 21, 2023

Types representing requests or response data often use types like Option<Box<String>>. For example:
https://github.com/fastly/fastly-rust/blob/release/v1.1.0/src/models/version_create_response.rs#L16

What's the reason for using a Box here? It seems unnecessary and leads to clumsy code handling those data structures.

@jannic
Copy link
Author

jannic commented Jan 22, 2023

Another observation: This seems to happen for Strings used as an id. I didn't find the openApi spec this code is generated from, so I couldn't check myself: Are those fields defined in a somehow special way? It seems like the isModel flag is true for those. The Rust generator uses Box if isModel is true, to avoid problems with recursive types. But that's of course not necessary for fields of type String.

@Integralist
Copy link
Collaborator

👋🏻 Thanks for opening this issue @jannic

Just to let you know we have now opened an internal ticket to track this issue.

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

No branches or pull requests

2 participants