@implydata/openapi-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.1 • Public • Published

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 generation of react-query hooks (queries, mutations) for each operation
  • Supports fetch by default but switches to XHR (via dynamic import) when upload progress is needed
  • Supports OpenAPI specification v2.0 and v3.0
  • Supports JSON and YAML files for input
  • Supports generation through CLI, Node.js and NPX
  • Supports aborting of requests (via AbortController and AbortSignal)
  • 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)
    --exportCore                Write core files to disk (default: true)
    --exportServices            Write services to disk (default: true)
    --exportModels              Write models to disk (default: true)
    --exportHooks               Write react-query hooks to disk (default: false)
    --exportSchemas             Write schemas to disk (default: false)
    --indent <value>            Indentation options [4, 2, tab] (default: "4")
    --postfix <value>           Service name postfix (default: "Service")
    --reactQueryImport <value>  Import specifier for react-query (default: "@tanstack/react-query")
    -h, --help                  display help for command

  Examples
    $ openapi --input ./spec.json --output ./generated
    $ openapi --input ./spec.json --output ./generated --exportHooks --indent 2

Documentation

Install

npm i @implydata/openapi-ts

DownloadsWeekly Downloads

72

Version

1.0.0-beta.1

License

MIT

Unpacked Size

177 kB

Total Files

6

Last publish

Collaborators

  • akhilamukka
  • dloftus-imply
  • vtlim
  • will.brantley
  • jproimply
  • imply_aleksej
  • abhishek-radhakrishnan
  • findingrish
  • jonah-rankin
  • divyavalluripalli
  • margaretcbrewster
  • tsfenwick
  • imply-elliott
  • neha-ellur
  • amaechler
  • cryptoe
  • kishorepai
  • jwilsonimply
  • adarsh.sanjeev
  • qsss
  • pei.xing
  • benschuiling-imply
  • lakshsingla
  • shunsun
  • implyadmin
  • vadimon
  • lorem--ipsum
  • ofir
  • andreacyc
  • kyhtsang
  • davidgee
  • wylieallen-i
  • rob.jenkins
  • dclim
  • roughlycorrect
  • implyjw
  • apeck
  • andy.tsai
  • cemclaug
  • jgoz
  • abhishekagarwal.iitr
  • georgew5656
  • hazzelnut
  • imply-ddoroshenko
  • celineechangg
  • implybot
  • tylerreece22
  • dkoepke
  • arunramani_imply
  • agarboos
  • rmn7-imply
  • teddyty
  • starking192