0.0.7 • Published 4 years ago

swagger-to-ts-api v0.0.7

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

introduction

use @manifoldco/swagger-to-ts to generate typescript definition file and relevant api file

usage

  swagger to ts api

  Usage
    $ swagger-to-ts-api [input] [options]

  Options
    --help                display this
    --rename              rename json file, ture
    --output, -o          specify output file
    --prettier-config     (optional) specify path to Prettier config file
    --template, -t        (optional) specify template file
    --output-api          specify output api file

template.ejs

export function <%= operationId %>(
<% if (pathParams.length > 0) {%>
  param: {
<% for (let el of pathParams){ %>
  <%=el.name%>: string;
<%} %>
  }
<% } %>
<% if (query.length > 0) {%>
  <%=pathParams.length > 0? ',': ''%>
  query: {<% for (let el of query){ %>
    <%=el.name%><%=el.required?'':'?'%>: string;
<%} %>
  }
<% } %>
<% if (dataCode !== 'undefined') {%>
  <%=pathParams.length > 0 ||query.length > 0 ? ',': ''%>
  data: <%-dataCode%>
<% } %>
){
  console.log(`<%-path%>`, <%=dataCode !== 'undefined'? 'data,': ''%>'<%=method%>')
}
0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago