This project demonstrates how to use the typescript-fetch generator from the OpenAPI generator library in a React application.
- node.js
- Java (for generating the api client)
Install dependencies
npm install
Generate the API client
npm run generate-api-client
Run the application
npm run dev
To generate the API client from a custom schema, run:
npm run generate-api-client [schema URI]
Example:
npm run generate-api-client https://petstore.swagger.io/v2/swagger.json
The OpenAPI Generator utilizes an OpenAPI schema file as input and produces API classes in the src/api/generated-client
directory. Components can import the client and initiate API calls.