swag2ts
## `npm install -g swag2ts`
Last updated 2 months ago by shakyshane .
MIT · Original npm · Tarball · package.json
$ cnpm install swag2ts 
SYNC missed versions from official npm registry.

Todo

npm install -g swag2ts

Automatically generate Typescript namespaces from Swagger definitions

<summary>Click to see example output</summary>
export namespace AcmeManageBasketAddToBasketV1Put {
  export const description = "";
  export const method = "PUT";
  export const operationId = "acmeManageBasketAddToBasketV1AddProductPut";
  export const path = "/V1/baskets/mine/add";
  export interface Body {
      productId: number;
      qty: number;
      purchaseType: string;
  }
  export type Response = Response200 | Response401 | ResponseDefault;
  export type Response200 = string;
  export type Response401 = Definitions.AcmeErrorResponse;
}
export namespace Definitions {
  export interface AcmeErrorResponse {
      message: string;
  }
}

Quick-start

# install
npm install -g swag2ts
# or 
yarn global add swag2ts

# run against a single JSON file
swag2ts dir/myfile.json

# or pipe json to it
curl http://some.swagger.api/schema | swag2ts --stdin

Todo

  • [x] GET url params
  • [x] simpler local refs in definitions
  • [x] array refs
  • [x] test + lint + build in npm test
  • [x] CLI stdin
  • [x] CLI files
  • [ ] API
  • [x] support multiple file outputs
  • [ ] support separating paths from definitions in multi-file output

Current Tags

  • 2.5.0                                ...           latest (2 months ago)

14 Versions

  • 2.5.0                                ...           2 months ago
  • 2.4.4                                ...           5 months ago
  • 2.4.3                                ...           5 months ago
  • 2.4.2                                ...           5 months ago
  • 2.4.1                                ...           5 months ago
  • 2.3.1                                ...           9 months ago
  • 2.3.0                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 2
Dependencies (5)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |