-
Notifications
You must be signed in to change notification settings - Fork 17
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
Generate rust bindings from Kubernetes openapi #4
Comments
@qrilka Interested in working on this? |
@vijaylaxmid did you have any progress with this? Maybe some ideas? |
Yes, using procedure macro to generate would make sense. Something like:
in the kube-rs, similar derive: https://docs.rs/kube-derive/0.63.2/kube_derive/derive.CustomResource.html |
I don't have much experience with macros yes but the task looks interesting and looks helpful for infinyon/fluvio#1131 that I was originally looking into when starting with k8-api/fluvio |
@sehz how could proc macro approach use Open API spec? The only sensible option I see is to list derived specs and test their conformance to the spec (but that could require some extra Spec details to be available at least when tests are enabled) |
procedure macro just generates boiler plate once trait is defined. You can take look at how to parse as in here: https://github.com/infinyon/fluvio/tree/master/crates/fluvio-protocol-derive |
Sure but I guess the mapping from OpenAPI spec to Spec in Rust code base is a manual thing, right? |
@sehz I was looking a bit into other things and read a bit more about proc macros and as for this ticket - what actually should a macro derive here?
Do I miss something here? |
|
This doesn't seem to be a lot boilerplate but OK. |
Can implement field attributes like #[serde(default = "path")], so this can be something like:
|
And what does "same_service" mean your example?
So it looks like |
|
I see but what about changing the types a bit? I think it would be more elegant to split |
Make sense |
Hey. could we use https://github.com/kube-rs/kube-rs client? I am happy to port fluvio/#1131 to it and see how well it works? I have love / hate relationship with the current crop of OpenAPI rust generators :/ |
@pinkforest I asked about kube-rs previously - #92 (comment) |
Kubernetes uses OpenAPI spec: https://github.com/kubernetes/kubernetes/tree/master/api/openapi-spec to define their api.
Generate rust k8-api bindings from the spec which implements Spec trait as in the example:
The text was updated successfully, but these errors were encountered: