xclud / dart_kubernetes

Kubernetes client for Dart/Flutter.
https://pub.dev/packages/kubernetes
MIT License
14 stars 5 forks source link

Add copyWith methods to data models #4

Open pattobrien opened 9 months ago

pattobrien commented 9 months ago

Hey there! Very impressed by the collection of k8s models, thanks a lot for your work on them so far.

Would you be willing to add "copyWith" functionality to each of the generated schemas, or accept a PR for doing so? I didn't see where the automation script was located, but if you'd like to share that I could take a look at implementing this myself.

Thanks in advance, and I'm looking forward to contributing how I can!

xclud commented 9 months ago

Hi @pattobrien

This is a great addition to have. The generation code is written in C# and is extremely dirty. I don't even think about sharing it unless i clean up and refactor the code.

pattobrien commented 9 months ago

Haha I totally get that, but no judgment here - as long as it works, thats what's most important 😉

I'm vaguely familiar with C#, but have a good amount of expertise in Dart generation tools, the analyzer packages, etc.. Have you considered porting the tooling over to Dart? If that makes sense for you and the project, then I can definitely help out.

I'm not sure how complex such a tool might be, but I assume the implementation looks something like this:

If you'd be up for sharing some related info with me, I'd be more than happy to do the heavy lifting for the code gen tool. The features we could add for each model would be:

Let me know your thoughts and I might be able to get started with this sometime over the next couple of weeks.

xclud commented 9 months ago

The process is exactly like you wrote. for k8s i generated the code from OpenAPI spec, but for other projects like Istio i used the yaml definition files. So basically it is two code generators coupled with each other and made the code dirty.

I started to port everything to dart a while ago. But since i didn't have free time, i didn't continue working on it.

So why not, let's begin. I will share with some code in the coming days.