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

a body property named default generates non-compiling code #1019

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

ahl
Copy link
Collaborator

@ahl ahl commented Dec 24, 2024

Fixes #557

The problem was that we generated a builder like this:

            pub fn default<T>(mut self, value: T) -> Self
            where
                T: ::std::convert::TryInto<bool>,
                T::Error: ::std::fmt::Display,
            {
                self.default = value
                    .try_into()
                    .map_err(|e| format!("error converting supplied value for default: {}", e));
                self
            }

No problem there... until we tried to create the operation builder:

        pub fn new(client: &'a super::Client) -> Self {
            Self {
                client: client,
                body: Ok(types::builder::Foo::default()),
            }
        }

This PR changes the call to this:

        pub fn new(client: &'a super::Client) -> Self {
            Self {
                client: client,
                body: Ok(::std::default::Default::default()),
            }
        }

@ahl ahl merged commit cf8d20f into main Dec 24, 2024
9 checks passed
@ahl ahl deleted the prop-named-default branch December 24, 2024 23:03
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 this pull request may close these issues.

Seemed to break on param called default
1 participant