Used by the generator for generating a API request builder class
The service metadata model converted from the open api file.
class declaration structure of the API request builder class
Builds an OpenApiServiceMetadata from the given open api definition file.
the path to the open api definition file
the service name
the directory name to store generated files for the service
REST Generator
This is currently not release ready. excluded in
mail.ts
.The generator wraps only the openapi-generator. This is a flexible tool using many commandline flags and templates for easy adjustment.
Command line arguments
Repo For mustache files
In the wrapping
generator-cli
we currently only exposeinputDir
andoutputDir
to generate tyescript-axios sources from the openapi.json files.Things we have adjusted to the OpenApi Generator
templates/baseApi.mustache
to achieve that.Usage
To run the generator use:
Once you have the generated classes, you can make calls via:
import { AxiosResponse } from 'axios'; import { SalesOrdersApi, InlineResponse200 as ResponseSalesOrder } from 'generated/sales-orders'; const response: AxiosResponse<ResponseSalesOrder> = await new SalesOrdersApi({ accessToken, basePath }).getSalesOrders()
Besides bearer token also basic is supported for authentication.
Problem Generator
'--additional-properties=withSeparateModelsAndApi=true'
and you have the templates enables, the model files are empty. Most likely there is no template found for the type.