Skip to content

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

Merged
ahl merged 1 commit intomainfrom
prop-named-default
Dec 24, 2024
Merged

a body property named default generates non-compiling code#1019
ahl merged 1 commit intomainfrom
prop-named-default

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
abus-sh pushed a commit to abus-sh/progenitor that referenced this pull request Dec 5, 2025
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