Code Generation Options

SwaggerHub lets you customize code generation options for server stubs and client SDKs for individual APIs. Each language or framework has specific options for it, such as package names, import mappings, and so on.

You can also hide specific languages from the Export menu on your API pages, for example, if you do not want your API platform to support some language.

Considerations

  • Code generation options apply to the code downloaded via the Export menu and the code generated by source control integrations (GitHub, Bitbucket, and others).

  • Code generation options apply to a specific API version. They are not shared between versions or copied when you create a new version or fork the API.

Change code generation options

To change code generation options, you must be the API owner or a collaborator with the Editor role.

  1. Open your API in the SwaggerHub editor.

  2. If the API has several versions, select the version for which you want to change code generation options.

    Selecting an API version
  3. From the Export menu, select Codegen Options.

The Edit Codegen Options dialog lists all the available languages and frameworks for code generation. Select a language to view its options.

Codegen options

Click the image to enlarge it.

The buttons work as follows:

  • Hide Option – Hides the selected language from the Download menu on the API page. To add the language again, click Show Option.

  • Delete – Restores the original options of the selected language. If the language is hidden, it will be shown again.

  • Revert – Cancels any unsaved changes you have made during the current editing session. This is different from Delete, which reverts all the changes ever made.

See Also

Publication date: