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

kube-derive types don't generate kind/apiVersion #315

Closed
ctron opened this issue Sep 1, 2020 · 3 comments · Fixed by #319
Closed

kube-derive types don't generate kind/apiVersion #315

ctron opened this issue Sep 1, 2020 · 3 comments · Fixed by #319
Labels
bug Something isn't working derive kube-derive proc_macro related

Comments

@ctron
Copy link
Contributor

ctron commented Sep 1, 2020

A type defined by k8s-openapi provides kind/apiVersion:

apiVersion: ""
kind: ""
metadata: {}
spec: {}

A type defined with kube-derive does not provide kind/apiVersion

apiVersion: v1
kind: ServiceAccount
metadata: {}

Reproducer:

println!(
    "{}",
    serde_yaml::to_string(&ServiceAccount {
        ..Default::default()
    })?
);

println!(
    "{}",
    serde_yaml::to_string(&Foo {
        ..Default::default()
    })?
);

My expectation would be, that kube-derive types do provide the same information.

ctron added a commit to ctron/kube-rs that referenced this issue Sep 1, 2020
ctron added a commit to ctron/kube-rs that referenced this issue Sep 1, 2020
clux added a commit that referenced this issue Sep 9, 2020
@clux clux added bug Something isn't working derive kube-derive proc_macro related labels Sep 9, 2020
clux added a commit that referenced this issue Sep 10, 2020
@clux clux closed this as completed in #319 Sep 10, 2020
@clux
Copy link
Member

clux commented Sep 10, 2020

This was only a problem when using the #[kube(derive = "Default")] and using Foo::default rather than Foo::new (which is a reasonable thing to do. We now manually specialise default for the generated type if the above instruction is given.

@clux
Copy link
Member

clux commented Sep 10, 2020

Released in 0.42.0. Thanks for the issue!

@ctron
Copy link
Contributor Author

ctron commented Sep 11, 2020

Released in 0.42.0. Thanks for the issue!

Looks good, thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working derive kube-derive proc_macro related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants