-
Notifications
You must be signed in to change notification settings - Fork 28
autogenerate client sdk from swagger definition #246
Comments
Awesome idea! |
First, more issues like this, please. 😄 I like the idea of having the API build process create the client. We didn't think of this but makes a ton of sense. Let's go over a couple of things with the API.
We'll take a look at the links you posted and see what we can fit into our current roadmap. Thanks again! |
API KEYI don't think the API key thing is a big deal (who owns it, etc), just generating the client Roadmapugh. i'll regret this later, but.... I'd probably be willing to open source assist in this. time box it to a few hours and i'll execute on it. |
This is the open source project you want to use; https://github.com/go-swagger/go-swagger It's exactly what you're looking for. Run it in docker. NOTE: I have not used this package. But software written in golang is usually of high quality.Go compiles into a binary that runs anywhere. Combine that with the flexibility of docker and you're golden. // command line.. Now you are in the command line of the docker image. Then you can: (I copied and pasted below from their repo) Good Luck!!Installing
Use-casesThe main package of the toolkit, go-swagger/go-swagger, provides command line tools to help working with swagger. The toolkit is highly customizable and allows endless possibilities to work with OpenAPI2.0 specifications. Beside the go-swagger CLI tool and generator, the go-openapi packages provide modular functionality to build custom solutions on top of OpenAPI. The CLI supports shell autocompletion utilities: see here. Serve specification UIMost basic use-case: serve a UI for your spec:
Validate a specificationTo validate a Swagger specification:
Generate an API serverTo generate a server for a swagger spec document:
Generate an API clientTo generate a client for a swagger spec document:
Generate a spec from sourceTo generate a swagger spec document for a go application:
Generate a data modelTo generate model structures and validators exposed by the API:
Transform specsThere are several commands allowing you to transform your spec. Resolve and expand $ref's in your spec as inline definitions:
Flatten your spec: all external $ref's are imported into the main document and inline schemas reorganized as definitions.
Merge specifications (composition):
Compare specsThe diff command allows you to check backwards compatibility.
Try itTry |
What's up?
The existing/POC API GSA/code-gov-api-client is out of date, and instead of trying to update it, you're probably better off generating an entirely new client, based on your existing swagger documentation.
What am I looking for
Configuring some sort of client generation process into the build pipeline for this application that will also keep a modern client up to date.
Alternatives?
Rewriting the existing API client to be up to date. But it doesn't even know about API_KEY, let alone all the current endpoints and params. This also seems like a losing battle as the api and site evolve 🤞
Additional context
Mucked around with this: https://www.npmjs.com/package/swagger-node-codegen
But I think it only generates a server based on a swagger def
This looks like a thing (https://app.swaggerhub.com/help/apis/generating-code/client-sdk), but i'm not installing a desktop app for this.
This seems like exactly what I want (https://github.com/swagger-api/swagger-codegen/wiki/FAQ), but like hell am I installing maven and java on this computer just for this task.
So, what am I really doing? Hoping yall will do me a solid and build this thing for me in exchange for me doing the leg work.
The text was updated successfully, but these errors were encountered: