-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mindev: Add utility to generate a data source definition from a Swagger doc #5283
base: main
Are you sure you want to change the base?
Conversation
89bbb38
to
3bc684b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add 1 or more tests so we can ensure we don't accidentally break the generation part. Otherwise it looks good 👍
will do... on Wednesday 😄 |
…er doc This adds the following command: `mindev datasource generate ...` The aforementioned command will read a swagger doc (OpenAPI v2) and will generate the appropriate data source definition out of it. I went for v2 since there was an easy-to-use implementation ready. Adding v3 support is left as a TODO item. Here's a demo of how usage would look like: ``` $ cat sample.yaml swagger: "2.0" info: title: Sample API description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML. version: 0.1.9 basePath: http://api.example.com/v1 paths: /users: get: summary: Returns a list of users. description: Optional extended description in CommonMark or HTML. responses: "200": # status code description: A JSON array of user names content: application/json: schema: type: array items: type: string $ go run cmd/dev/main.go datasource generate sample.yaml version: v1 type: data-source context: {} name: Sample-API rest: def: get_users: endpoint: http://api.example.com/v1/users method: GET parse: json inputSchema: {} ``` Signed-off-by: Juan Antonio Osorio <[email protected]>
Co-authored-by: Radoslav Dimitrov <[email protected]>
Co-authored-by: Radoslav Dimitrov <[email protected]>
Oh, in that case I don't mind merging this one and doing it as a follow up 👍 |
Summary
This adds the following command:
mindev datasource generate ...
The aforementioned command will read a swagger doc (OpenAPI v2) and will
generate the appropriate data source definition out of it.
I went for v2 since there was an easy-to-use implementation ready.
Adding v3 support is left as a TODO item.
Here's a demo of how usage would look like:
Change Type
Mark the type of change your PR introduces:
Testing
Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.
Review Checklist: