Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Wiki
  • How to add a generator for a new language or framework

How to add a generator for a new language or framework · Changes

Page history
update reference authored Aug 11, 2018 by William Cheng's avatar William Cheng
Hide whitespace changes
Inline Side-by-side
How-to-add-a-generator-for-a-new-language-or-framework.md
View page @ 35885889
......@@ -2,19 +2,18 @@
To add an API client generator for a new language (e.g. Go), we would recommend going through the following PR as a starting point:
- [[Go] Add Go API client generator #1747](https://github.com/swagger-api/swagger-codegen/pull/1747).
- [New Javascript flowtyped generator #176](https://github.com/OpenAPITools/openapi-generator/pull/176)
Here is a summary of the changes:
- Add [`modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java`](https://github.com/wing328/swagger-codegen/blob/20e531d6dd0a8ed71d1b8cab62ad869f56f700bc/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java) which extends `DefaultCodegen`. It configures the language codegen, sets `templateDir = "go"` which is used to locate the codegen's mustache templates, adds the template files `api.mustache` and `models.mustache` (see below), and adds the language CLI option. Change as necessary for your language.
- Add the class to [`modules/openapi-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig`](https://github.com/wing328/swagger-codegen/blob/20e531d6dd0a8ed71d1b8cab62ad869f56f700bc/modules/openapi-generator/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig)
- Add a [`modules/openapi-generator/src/main/resources/go/README.mustache`](https://github.com/wing328/swagger-codegen/blob/20e531d6dd0a8ed71d1b8cab62ad869f56f700bc/modules/openapi-generator/src/main/resources/go/README.mustache)
- Add the [`modules/openapi-generator/src/main/resources/go/api.mustache`](https://github.com/wing328/swagger-codegen/blob/20e531d6dd0a8ed71d1b8cab62ad869f56f700bc/modules/openapi-generator/src/main/resources/go/api.mustache) and [modules/openapi-generator/src/main/resources/go/model.mustache](https://github.com/wing328/swagger-codegen/blob/20e531d6dd0a8ed71d1b8cab62ad869f56f700bc/modules/openapi-generator/src/main/resources/go/model.mustache)
- Add samples in `samples/client/petstore/go` and `.sh` and `.bat` scripts to generate the samples
- Add [`modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java`](https://github.com/jaypea/openapi-generator/blob/f216b24edd48780c4fbe7b7393a32a9c0f2a0f57/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java) which extends `AbstractTypeScriptClientCodegen` (other generators usually extend `DefaultCodegen`). It configures the language codegen, sets `templateDir = "Javascript-Flowtyped"` which is used to locate the codegen's mustache templates, adds the template files `api.mustache` and `models.mustache` (see below), and adds the language CLI option. Change as necessary for your language.
- Add the class to [`modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig`](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig)
- Add an auto-generated README file to explain how to use the auto-generated code
- Add the [`modules/openapi-generator/src/main/resources/Javascript-Flowtyped/api.mustache`](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/api.mustache) and model.mustache
- Add samples in `samples/client/petstore/javascript-flowtyped` and `.sh` and `.bat` scripts to generate the samples
To add a server stub generator for a new framework (e.g. Haskell Servant), please go through the following PRs:
- [Code generator for haskell-servant framework #2009](https://github.com/swagger-api/swagger-codegen/pull/2009)
- [[aspnet] Initial implementation of ASP.NET 5 server #2024](https://github.com/swagger-api/swagger-codegen/pull/2024)
- [[PHP][LARAVEL] initial PHP-laravel integration #574](https://github.com/OpenAPITools/openapi-generator/pull/574)
If you need any assistance, please open a [ticket](https://github.com/openapitools/openapi-generator/issues)
......
Clone repository
  • API client generator HOWTO
  • Building your own Templates
  • Customizing client code generation
  • FAQ
  • Git Branches
  • Home
  • How to add a generator for a new language or framework
  • Integration Tests
  • Migration Guide
  • Mustache Template Variables
  • Pull Request Checklist
  • Release Checklist
  • Samples folder
  • Server stub generator HOWTO
  • Vendor Extensions
View All Pages