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

feat(derive): add option to derive serde(default) attribute #4

Closed

Conversation

maxjoehnk
Copy link

I really like this crate. It's great for loading multiple layers of configuration but as it wasn't possible to add the serde(default) attribute only to the derived struct I've added this flag.

@bengreenier
Copy link
Owner

bengreenier commented Oct 31, 2023

thanks @maxjoehnk - sorry, just seeing this now. I'll make time to review this later today, and get it merged/an update out soon baring any issues.

@bengreenier bengreenier added the enhancement New feature or request label Oct 31, 2023
@bengreenier bengreenier self-assigned this Oct 31, 2023
@bengreenier
Copy link
Owner

bengreenier commented Oct 31, 2023

@maxjoehnk could you take a look at #5 and tell me what you think? It supports this feature, but in a more generic way (so it works with other libraries that use container attributes that one might want to define on a Partial as well).

#[derive(Partial)]
#[partially(derive(Serialize, Deserialize))]
#[partially(attribute(serde(default)))]
struct Data {
  value: String
}

If that meets your needs then I will close this one out, in favor of #5 with complete credit for the idea going to you 😄

@maxjoehnk
Copy link
Author

That looks great. I'm only on mobile right now so couldn't test it but this should solve my use case.

Imo you can close this PR and replace it with #5.

@bengreenier
Copy link
Owner

bengreenier commented Oct 31, 2023

alright - that's shipped - crates.io - docs.rs

thanks for the idea/PR @maxjoehnk - closing this one out now - let me know if you have any issues!

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

Successfully merging this pull request may close these issues.

None yet

2 participants