Giter Site home page Giter Site logo

zhenghangjie / openapi-typescript-codegen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ferdikoomen/openapi-typescript-codegen

0.0 1.0 0.0 21.09 MB

NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification

License: MIT License

JavaScript 2.50% TypeScript 83.70% HTML 0.05% Handlebars 13.76%

openapi-typescript-codegen's Introduction

OpenAPI Typescript Codegen

NPM License Coverage Quality Code Climate Downloads Build

Node.js library that generates Typescript clients based on the OpenAPI specification.

Why?

  • Frontend โค๏ธ OpenAPI, but we do not want to use JAVA codegen in our builds
  • Quick, lightweight, robust and framework-agnostic ๐Ÿš€
  • Supports generation of TypeScript clients
  • Supports generations of Fetch, Node-Fetch, Axios, Angular and XHR http clients
  • Supports OpenAPI specification v2.0 and v3.0
  • Supports JSON and YAML files for input
  • Supports generation through CLI, Node.js and NPX
  • Supports tsc and @babel/plugin-transform-typescript
  • Supports aborting of requests (cancelable promise pattern)
  • Supports external references using json-schema-ref-parser

Install

npm install openapi-typescript-codegen --save-dev

Usage

$ openapi --help

  Usage: openapi [options]

  Options:
    -V, --version             output the version number
    -i, --input <value>       OpenAPI specification, can be a path, url or string content (required)
    -o, --output <value>      Output directory (required)
    -c, --client <value>      HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
    --name <value>            Custom client class name
    --useOptions              Use options instead of arguments
    --useUnionTypes           Use union types instead of enums
    --exportCore <value>      Write core files to disk (default: true)
    --exportServices <value>  Write services to disk (default: true)
    --exportModels <value>    Write models to disk (default: true)
    --exportSchemas <value>   Write schemas to disk (default: false)
    --indent <value>          Indentation options [4, 2, tab] (default: "4")
    --postfixServices         Service name postfix (default: "Service")
    --postfixModels           Model name postfix
    --request <value>         Path to custom request file
    -h, --help                display help for command

  Examples
    $ openapi --input ./spec.json --output ./generated
    $ openapi --input ./spec.json --output ./generated --client xhr

Documentation

Support

openapi-typescript-codegen's People

Contributors

dependabot-preview[bot] avatar ferdikoomen avatar dependabot[bot] avatar markbrockhoff avatar budde377 avatar nandorojo avatar mrtnvh avatar jurgenbelien avatar mlaps-gafe avatar vyobukhov avatar raman-savitski-exadel avatar mb21 avatar dbo avatar troglotit avatar visortelle avatar huzaifahj avatar asc11cat avatar todesstoss avatar vitalybaev avatar sheshnathverma avatar rossille avatar ronaldvdh-isaac avatar qqilihq avatar nikopavlica avatar npwork avatar mvasin avatar michael-land avatar thetrime avatar macko911 avatar vrslev avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.