Giter Site home page Giter Site logo

typegen's Introduction

Swagger Typegen

codecov

Install

Run yarn to install dependencies.

Global npm install

Typegen is globally installable as an npm cli tool.

To install it run npm link from the root of the project.

How to generate the type file

typegen example/input.json -o example/output.ts

Parameters

  • input (required) - The path to swagger file in JSON format
  • -o, --output [filename] (optional) - the path to the output file. By skipping this param, the output is returned in the terminal.

typegen's People

Contributors

matthiasmargot avatar boobo94 avatar

Stargazers

Edvin CANDON avatar

Watchers

 avatar Adrià Casajús avatar Alexandru Razvan Dumitru avatar  avatar  avatar

Forkers

edvincandon

typegen's Issues

Provide possibility of logging output generated from typegen to the console instead of interacting with the file-system

This is necessary to support the following use-cases:

  • appending the generated output to an already existing file
  • funneling the output of this tool into further processing

One proposal is to add an optional flag which instructs the tool not to write the generated output to the file-system but to instead log it back to the console:

typegen input.json --log

# take the output and do something additional with it
# such as appending it to an already existing file
typegen input.json --log >> outpu.ts

Restore support for yaml files

There's a dependency specified for this project called "swagger-parser" that's currently not used.
It was introduced to support yaml as the input format for source-files that typegen should parse.
Currently typegen only supports json format.

Support for yaml should be added, some options for API implementation:

  1. add an optional "type" / "extension" flag to the CLI defaulting to json
  2. figure out the file-type based on its contents, for this case it should be fine to assume a limitation to only json/yaml
  3. figure out the file-type based on the extension provided in the input & output file-path arguments (this is un-desirable since it forces the user to specify file extensions in the argument, that shouldn't be necessary)

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.