Skip to content

Latest commit

 

History

History
66 lines (39 loc) · 2.02 KB

File metadata and controls

66 lines (39 loc) · 2.02 KB

日本語

This section describes the specific steps for code generation.

Setup

First, you need to clone this repository.

git clone https://github.com/Himenon/openapi-typescript-code-generator-demo-project

Then go to the cloned directory and install the package.

cd openapi-typescript-code-generator-demo-project
yarn install

The setup is now complete.

Run demo

Let's actually create the code in Usage. The OpenAPI Schema to be loaded is openapi.yml.

Also, the actual code to be executed will be written in plain JavaScript.

Demo1

Examples to DEMO:Generate typedef-only code

Execute the following command to generate the code in the demo1 directory.

node generate-demo1.js

Demo2

Examples to DEMO:Generate code containing the API Client

Execute the following command to generate the code in the demo2 directory.

node generate-demo2.js

Demo3

Examples to DEMO:Split the type definition file and the API Client implementation

Execute the following command to generate the code in the demo3 directory.

node generate-demo3.js

About the package you need

@himenon/openapi-typescript-code-generator provides a mechanism for generating code from OpenAPI Schema.

It also uses TypeScript itself directly internally. Therefore, if you do not have this typescript package installed, you will not be able to generate code.