Make binary self-contained
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.
@mitchtbaum how would this work exactly?
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.
@danielgtaylor I updated the issue. does that make sense? would you have interest in coding/merging it?
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:
-
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.
-
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?
to get the ball rolling, I have some questions, starting with:
- what would it look like to switch the current codebase from a hardcoded cli interface to one that reads from a config file instead?
- what translation is necessary to generate an in-memory representation of an api's semantics that could make it read an openapi file directly, instead of from a config file? (which you're basically doing already in order to generate the compileable environment)
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
@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 ?