Skip to content

a package to generate an client for open-api 3.x

Notifications You must be signed in to change notification settings

dimitar-cp/st-open-api

 
 

Repository files navigation

st-open-api

this api create a client for open api specification version 3.0.x

usage: npx st-open-api -s open-api.json -o client

options

-s source required the path or url to open-api as JSON

-o output required the output path existing files will be overridden

-f force optional ignore result of validation: default false

-d debug optional output debug information: default false

-l language optional choose your output language (ts|js|onlyJs): default ts

-n serviceSuffix optional choose your service suffix: default Service

-c component optional generate only components

Configuration

configure the global openApi can be manipulate some variables and every request. Right now not bound to window object

requestInterceptor: is called before any request is done, here you can manipulate every request, for example add an api-token header.

endpointUrl: add here the endpoint url that will be set in every request as prefix.

Examples

Setting a specific endpoint url global or a request interceptor

openApi.endpointUrl = "https://localhost:4444";

TODO

  • add suffix for enumerations and add a get values list
  • delete typings on js maybe js only
  • time to add tests
  • add a configuration file how to split services

About

a package to generate an client for open-api 3.x

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 91.7%
  • Mustache 6.1%
  • JavaScript 2.2%