nickel
nickel copied to clipboard
feature request: OpenAPI Generator (`openapi2nickel`)
Is your feature request related to a problem? Please describe.
Given the stated goals, it seems like having an openapi2nickel
tool would be rather valuable.
If this tool existed, and assuming the OpenAPI specs are... of good quality, it is fun to imagine being able to auto-generate Nickel modules for things like Kubernetes resources, Azure IaaS resources, etc.
Describe the solution you'd like
Someone to create an openapi2nickel
tool.
Describe alternatives you've considered Hm, I'm not sure what an alternative would be, this is kind of a specific idea.
Additional context Related-ish work?
- https://github.com/dhall-lang/dhall-kubernetes (I think this uses K8s's OpenAPI specs? )
- https://github.com/xtruder/kubenix (Uses Swagger (openapi predecessor, similar/same format to generate Nix modules for Kubernetes resource types. cc: @offlinehacker @xtruder)
I realize this is a big feature request and might make better sense as a standalone tool, but I figured I might open this anyway for discussion?
By openapi I assume you mean json schema definitions part which are used for request/responses in openapi.
Just one note, in kubernetes case they have some extra fields that define merging rules for lists (by which key objects in lists are merged), so generator might need to be extensible enough to support such cases.
Hello, and thanks for the suggestion! The focus is on an MVP right now but this is definitely something to look at.
As an update, @AleksanderGondek has begun to tackle this kind of stuff for kubernetes: [EDIT: not yet public]
(note: seems to be a private repo for now)
Oops, you're right, it's still WIP and probably not in a releasable state. Let us wait for Aleksander to polish it and release it at some point.
The code transforming openapi (v2) into nickel is functional but needs a bit more effort to share it - I will open the repository as soon as it is in state encouraging cooperation (and somewhat usable :) )
Hello. Any chance there was progress on this? Would it be possible to make the repo' available so others could contribute?
@LloydNinjago https://github.com/tweag/nickel-kubernetes/tree/master/openapi2-to-nickel Cheers!
Closing in favor of #418. Note that a JSON schema to Nickel contract converter is to be worked on by @vkleen soon.