community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

[Plugin] OpenApi Generator as templater for scaffolder plugin

Open kiranpatel11 opened this issue 4 years ago • 2 comments

Summary

For API-First approach, OpenApi generator is a convenient way to bootstrap a project with actual rest endpoints and data model included in code generation in a dynamic way.

The feature can be enhancement to scaffolder-backend plugin or a separate plugin to provide openapi-generator as templater.

https://github.com/OpenAPITools/openapi-generator https://www.npmjs.com/package/@openapitools/openapi-generator-cli

Context

Most of the templates are static in nature with include HelloWorld kind of examples, which often serve purpose of reference implementation and need to be removed after initial code generation. OpenApi Generator takes api definition as input and code generation can be made more dynamic and useful for actual usecase and implementation standards.

kiranpatel11 avatar Mar 10 '21 08:03 kiranpatel11

So with the new version of templates, you are free to make your own actions that run as part of the scaffolding. Sounds to me like it might be interesting to make an action that can run the openapi generator. You can either add that as a custom action of your own, or contribute it to open source. I suppose that the user will want to select from a number of different API definitions then? How do you envision that the user flow would look, should the user supply a URL to an API definition in their version control system when filling out the template form?

freben avatar Mar 16 '21 07:03 freben

Here is an example cli usage

openapi-generator-cli generate -g ruby -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /var/tmp/ruby-client

Yes, all these options can be supplied by filling out template form.

Indeed, actions are now more appropriate to address such needs.

kiranpatel11 avatar Mar 16 '21 10:03 kiranpatel11

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 08 '24 00:09 github-actions[bot]