Once installed, you can use the openapi-generator-cli to generate client code. Here’s a brief on the command:
-i your-openapi-spec.yaml: This specifies the input OpenAPI specification file. Replace your-openapi-spec.yaml with the path to your actual OpenAPI YAML or JSON file.
-g typescript-fetch: This specifies the generator to use. In this case, it generates a TypeScript client using the fetch API.
-o src/api: This specifies the output directory where the generated code will be saved.
Commit
install openapi cli tool
Once installed, you can use the openapi-generator-cli to generate client code. Here’s a brief on the command:
-i your-openapi-spec.yaml: This specifies the input OpenAPI specification file. Replace your-openapi-spec.yaml with the path to your actual OpenAPI YAML or JSON file. -g typescript-fetch: This specifies the generator to use. In this case, it generates a TypeScript client using the fetch API. -o src/api: This specifies the output directory where the generated code will be saved.
setup the openapi spec