nickel icon indicating copy to clipboard operation
nickel copied to clipboard

feature request: OpenAPI Generator (`openapi2nickel`)

Open colemickens opened this issue 4 years ago • 8 comments

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?

colemickens avatar Oct 23 '20 22:10 colemickens

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.

offlinehacker avatar Oct 24 '20 04:10 offlinehacker

Hello, and thanks for the suggestion! The focus is on an MVP right now but this is definitely something to look at.

yannham avatar Oct 26 '20 08:10 yannham

As an update, @AleksanderGondek has begun to tackle this kind of stuff for kubernetes: [EDIT: not yet public]

yannham avatar Sep 03 '21 07:09 yannham

(note: seems to be a private repo for now)

bew avatar Sep 03 '21 08:09 bew

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.

yannham avatar Sep 03 '21 08:09 yannham

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 :) )

AleksanderGondek avatar Sep 03 '21 09:09 AleksanderGondek

Hello. Any chance there was progress on this? Would it be possible to make the repo' available so others could contribute?

LloydNinjago avatar Jan 19 '22 09:01 LloydNinjago

@LloydNinjago https://github.com/tweag/nickel-kubernetes/tree/master/openapi2-to-nickel Cheers!

AleksanderGondek avatar Jan 21 '22 09:01 AleksanderGondek

Closing in favor of #418. Note that a JSON schema to Nickel contract converter is to be worked on by @vkleen soon.

yannham avatar Jun 15 '23 09:06 yannham