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

fix: #[kube(crates(serde = "some_crate::serde"))] was not working #1215

Merged
merged 1 commit into from May 16, 2023
Merged

fix: #[kube(crates(serde = "some_crate::serde"))] was not working #1215

merged 1 commit into from May 16, 2023

Conversation

chubei
Copy link
Contributor

@chubei chubei commented May 15, 2023

Motivation

#[kube(crates(serde = "some_crate::serde"))]

Solution

- Usage of serde should be interpolated as #serde

  • #[serde(crate = "some_crate::serde")] should be added to generated struct

Not sure how to add a test becaues kube-derive already depends on serde.

We can probably add another crate just for testing. Not sure if that's overshoot.

@chubei
Copy link
Contributor Author

chubei commented May 16, 2023

Looks like I broke the test. Will investigate.

because:

- Usage of `serde` should be interpolated as `#serde`
- `#[serde(crate = "some_crate::serde")]` should be added to generated struct

Signed-off-by: chubei <914745487@qq.com>
@chubei
Copy link
Contributor Author

chubei commented May 16, 2023

Updated.

@chubei chubei changed the title fix: #[kube(crates = "some_crate::serde")] was not working fix: #[kube(crates(serde = "some_crate::serde"))] was not working May 16, 2023
@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

Merging #1215 (34e36a9) into main (3e7f32e) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1215      +/-   ##
==========================================
- Coverage   73.50%   73.49%   -0.02%     
==========================================
  Files          68       68              
  Lines        5379     5380       +1     
==========================================
  Hits         3954     3954              
- Misses       1425     1426       +1     
Impacted Files Coverage Δ
kube-derive/src/custom_resource.rs 13.75% <0.00%> (-0.09%) ⬇️

@clux clux added the changelog-fix changelog fix category for prs label May 16, 2023
@clux clux added this to the 0.83.0 milestone May 16, 2023
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Looks like a clean fix, doesn't really hurt to put the extra #[serde(crate)] attribute everywhere if it is passing tests, so the current solution seems good (and better than alternative if-else based injection).

kube-derive/src/custom_resource.rs Show resolved Hide resolved
@clux clux merged commit 311f588 into kube-rs:main May 16, 2023
15 of 16 checks passed
@chubei
Copy link
Contributor Author

chubei commented May 16, 2023

Thanks for the quick merge! When will the next releases be?

@clux
Copy link
Member

clux commented May 16, 2023

Will probably try to make one next week. If you need this early, feel free to git pin via cargo.

@clux
Copy link
Member

clux commented Jun 5, 2023

Released in 0.83. Busy couple of weeks 😓
Thanks again!

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

Successfully merging this pull request may close these issues.

None yet

2 participants