Giter Site home page Giter Site logo

api-codegen-ts's Introduction

api-codegen-ts

A general typescript code generation library. Currently it can take swagger 2.0 and openapi 3.0.0+ json specs and turn them into typescript controllers that validate api responses.

Installation

npm i -D @nll/api-codegen-ts

Configuration

Add an apiCodegen section to package.json.

{
  "apiCodegen": {
    "src": "./path/to/your/swagger-spec.json",
    "dst": "./path/to/your/codegen/destination"
  }
}

Usage

After configuring api-codegen-ts you can generate code like so:

npx @nll/api-codegen-ts

And it will output its progress and output code.

Advanced usage

This codegen library abstracts parsers and printers. A parser is responsible for receiving an input string (a specification) and generating any intermediate representation. Currently, there are primitive swagger 2.0 and openapi 3.0.0 parsers. A printer takes an intermediate representation (it must match whatever the parser outputs) and returns the file strings to write to disk. The core functionality of api-codegen-ts is managing this workflow, it handles the reading of the source files and the printing of the generated files.

Support

This is my first attempt at a codegen library. If you find bugs or some set of features that aren't supported please create a github issue. Thanks!

api-codegen-ts's People

Contributors

baetheus 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.