-
Notifications
You must be signed in to change notification settings - Fork 4
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 types automatically #7
Comments
Yes, that was my plan - I just wanted to get a feel for the types "manually" before I worked on code generation. Now that I have implemented a few API types by hand, I've learned:
So, I'm in a quandary. I think what I should do is hack up something to help generate a first pass at the API types, and then apply some human effort to the results. Maintaining the result going forwards will also require human effort, unfortunately. I don't see that I have a choice however, unless I'm willing to accept significantly less descriptive types :( Opinions/patches sought. |
Opinion: those defects upstream should be fixed upstream.
|
Having thought about this more, I think we should declare bankruptcy on the openapi spec and work to re-describe the k8s API (really just the resource objects) in a new "better" IDL. I know that's radical, so I don't suggest it lightly. We need to add more information above what's currently available in the golang types, and hence generated openapi spec (eg: enums, default values). We could augment the openapi spec, but openapi is quite clumsy and verbose to use as the primary declaration (designed mostly for documentation rather than codegen, already extended with non-standard fields in k8s so it's not like we can use standard openapi codegen tools anyway). I think the right thing to do is to come up with a new language-neutral k8s-IDL, and back-generate the openapi (and other clients, like golang and Rust) from that. Ideally one day, we would also generate the official golang client - but importantly I don't think we should block by trying to "fix upstream" first because the priorities and incentives are not aligned. I would be interested in any other non-go/rust language clients that have might have had similar thoughts. |
Hi
Have you considered generating the types automatically from Kubernetes OpenAPI spec, for example using https://github.com/Arnavion/k8s-openapi-codegen?
//Max
The text was updated successfully, but these errors were encountered: