1.0.12 • Published 1 year ago

@udxsp/swagger-to-ts-type v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Swagger to TypeScript Types Generator

This project provides a tool to convert Swagger (OpenAPI 2.0) API definitions into TypeScript types. It uses axios to fetch Swagger definitions from a URL and fs to write the generated types to a .ts file.

Features

  • Converts Swagger definitions into TypeScript types.
  • Supports $ref references resolution within Swagger definitions.
  • Generates TypeScript types for operation requests and responses.

Prerequisites

Before you begin, ensure you have Node.js installed on your machine. This project has been tested with Node.js version 14.x.

Installation

To install the project dependencies, run the following command:

npm install

Usage

To generate TypeScript types from a Swagger file, run the following command:

npm run generate <your-swagger-file-url>

Where <your-swagger-file-url> is the URL of your Swagger JSON file.

The generated TypeScript types will be written to the file ./types/rest_types.ts.

Code Formatting

To format the codebase, run the following command:

npm run format

Testing

To run the tests and verify the correctness of the functions, use the following command:

npm test

Contributing

If you would like to contribute to the project, please submit a pull request with your changes or open an issue to discuss what you would like to change.

License

This project is released under the MIT License.

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago