danielgtaylor / openapi-cli-generator

Generate a CLI from an OpenAPI 3 specification
MIT License
179 stars 49 forks source link

Make binary self-contained #16

Open naturallymitchell opened 5 years ago

naturallymitchell commented 5 years ago

Instead of generating openapi-spec.go, make it possible for users to download a single binary and not need a Go build environment.

So instead of using code generation, build in the cli dependencies and abstract the openapi spec environment.

danielgtaylor commented 5 years ago

@mitchtbaum how would this work exactly?

naturallymitchell commented 5 years ago

Make OCG able to run openapi files itself without an additional compilation step.

So, instead of generating hardcoded output, abstract the app to use configurable inputs.

naturallymitchell commented 5 years ago

@danielgtaylor I updated the issue. does that make sense? would you have interest in coding/merging it?

danielgtaylor commented 5 years ago

I've spent some time thinking about this idea. I like the flexibility of pointing the executable to an OpenAPI file and having it Just Work:tm: but I haven't come up with good solutions for:

  1. How do you deliver a single zero-dependency executable for users to download? I don't want them to download this app plus my OpenAPI file, I just want one thing that works for my users.

  2. Right now you can hook into various parts of the CLI, request/response, etc to build customization and high level commands. How would this work without a compilation step?

naturallymitchell commented 5 years ago

to get the ball rolling, I have some questions, starting with:

phrohdoh commented 5 years ago

Would creating a containerized version of openapi-cli-generator be feasible?

That way the user technically has everything they need but packaged up in a nice container that they can ask to generate CLIs and completely purge the container from their machine once they've done everything they want.

I just came across dockerize which may be a workable solution.

Edit: Added a link to dockerize

joeblew99 commented 5 years ago

@danielgtaylor Its a weird issue but i can see its usefulness.

there is a openapiv3 parser that can do runtime parsing. https://github.com/getkin/kin-openapi

so then the developer woudl just have to implement handlers

Not sure if this hits the core of the use case ?