obmarg / kazan

Kubernetes API client for Elixir
https://hex.pm/packages/kazan
MIT License
138 stars 35 forks source link

Fix typespecs for optional model fields #77

Closed chazsconi closed 3 years ago

chazsconi commented 3 years ago

When generating the typespecs for models, the required field in the swagger definition is ignored, leading to dialyzer errors when instantiating a model struct without specifying all fields.

The AST previously created a typespec for a struct field like

my_field: my_type

but this PR now creates it as follows if the field is not required:

my_field: my_type | nil
obmarg commented 3 years ago

Nice @chazsconi - looks good.

I'm going to give you write permissions to this repo btw - no obligation to do anything (although if you want to feel free). I don't really do any Elixir these days, so probably shouldn't be the only person with the ability to push.

chazsconi commented 3 years ago

@obmarg thanks a lot for merging and also for giving me write access. I (or my colleagues) will probably create some more PRs that we have currently in a fork that we are using.

obmarg commented 3 years ago

Cool, feel free to make whatever changes you want - I'm sure you're far more qualified than I am at this point.

Can probably sort out hex.pm access for you as well if you'd like - I've had making a release on my todo list for probably over a year now 😅

chazsconi commented 3 years ago

hex access would be good also. I can make a release. Is there better way we can discuss this? Maybe Elixir slack - I'm chazsconi in this.

obmarg commented 3 years ago

Unfortunately I'm not really in any of the elixir community spaces anymore - on a few rust discords, but otherwise probably best to message me on twitter or email me

chazsconi commented 3 years ago

I've contacted you on gmail and twitter now thanks!

obmarg commented 3 years ago

Hi @chazsconi

Thanks, got both of them. Got a lot going on right now I’ll try and get back to you in the next few days

On Mon, Jul 19, 2021, at 11:50 AM, chazsconi wrote:

I've contacted you on gmail and twitter now thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/obmarg/kazan/pull/77#issuecomment-882448210, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEH3SVKXGOAGL4NUSORTU3TYP7RBANCNFSM474M2OXQ.