npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

saddleback-openapi-typescript-codegen

v0.34.1

Published

Library that generates Typescript clients based on the OpenAPI specification.

Downloads

22

Readme

Custom Saddleback OpenAPI Typescript Codegen

For original usage read - original README

Install

npm install saddleback-openapi-typescript-codegen --save-dev

Step-by-step guide based on ME app

auto fetch

  1. install the package
  2. create config files for every microservice that you need (put it in the root project folder for example openapiEvents.config.json)
  3. inside the config file you need to specify
    1. output folder (for Events it would be ./src/shared/api/events)
    2. microservice that you're specifying ("Events")
    3. environment that using for fetch ("feature")
    4. if you don't want to generate whole microservices, you can specify filterMethod and filterArray
  4. create utility files that used in services
    1. 'baseAxios' should export axios instance that be used for fetch
    2. 'getBaseConfig' and 'serviceError' described here https://github.com/saddlebackdev/church-management/wiki/Services
  5. run the command where you should pass your login and pass from saddleback identity server saddlebackApi --config openapiEvents.config.json --login login --password password

local swagger

  1. same as above
  2. same as above
  3. addition specify the input path to the swagger.json file
  4. same as above
  5. run the command saddlebackApi --config openapiEvents.config.json

Usage

Generated folders should be untouchable. Because every generate action will delete and put generated files into the output folder.

$ saddlebackOpenapi --help

  Usage: saddlebackOpenapi [options]

  Options:
    -V, --version             output the version number
    -i, --input <value>       OpenAPI specification, can be a path, url or string content
    -o, --output <value>      Output directory should end with service name workflows | events | notifications | core | journey | giving | smallGroup
    -c, --config <value>      Path to the config file
    -l, --login <value>       Login
    -p, --password <value>    Password
    -e, --environment <value> Environment dev | stage | stage2
    -s, --service <value>     Service Service Workflows | Events | Notifications | Core | Journey | Giving | SmallGroup
    -h, --help                display help for command
    -m, --filterMethod        Filter method include(default) | exclude')
    -f, --filterArray         Filter array

  Examples
    $ saddlebackOpenApi --input ./spec.json --output ./generated
    $ saddlebackOpenApi --config ./openapi.config.json
    $ saddlebackOpenApi -o "./folderPath" -l "Login" -p "Password" -e "dev" -s "core"

Config file

extends original OPTIONS

    input                           required in the config or cmd arguments
    output                          required in the config or cmd arguments

    additionalModelFileExtension    optional
    additionalServiceFileExtension  optional
    removeLodashPrefixes            optional

Settings:

input

  • Default: undefined
  • Type: string

OpenAPI specification, can be a path, url or string content (required in the config or cmd arguments)

output

  • Default: undefined
  • Type: string

Output directory (required in the config or cmd arguments)

login (autofetch)

  • Default: undefined
  • Type: string

Login to saddleback identity server

password (autofetch)

  • Default: undefined
  • Type: string

Password to saddleback identity server

environment (autofetch)

  • Default: undefined
  • Type: 'dev' | 'stage' | 'stage2'

Which Environment should be used for swagger.json

service (autofetch)

  • Default: undefined
  • Type: 'workflows' | 'event' | 'notifications' | 'core'

Which service should be fetched

filterMethod (autofetch)

  • Default: include
  • Type: 'include' | 'exclude'

Which method of sort should be applied to the filter array

filterArray (autofetch)

  • Default: undefined
  • Type: string[]

Which services should be included or excluded to/from generated list

additionalModelFileExtension

  • Default: true
  • Type: boolean

Apply *.models.* extension to model files.

For example (myModel.ts -> myModel.models.ts)

additionalServiceFileExtension

  • Default: true
  • Type: boolean

Apply *.service.* extension to service files.

For example (myService.ts -> myService.service.ts)

removeLodashPrefixes

  • Default: true
  • Type: boolean

Remove special prefixes that are separated by _ at the start of names.

For example (Custom_Prefix_Name -> Name)