fabien0102 / openapi-codegen

A tool for generating code base on an OpenAPI schema.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ability to generate all schemas with one call to the CLI

daviseford opened this issue · comments

Hi, as a developer, I'd love to be able to use the CLI tool like so:

# Generates all schemas listed in the `openapi-codegen.config.ts` file
npx openapi-codegen gen *

# or, alternatively, maybe an empty argument for `gen` would mean "generate all"
npx openapi-codegen gen

# or, maybe
npx openapi-codegen gen --all

My project has a half dozen APIs added, each with their own generate command in my package.json. I'd love the ability to quickly update all of the APIs listed in the config file.

Currently, I manually accomplish this by doing something like this in my package.json, but you can see how it gets pretty verbose, pretty quickly

"gen:Api1": "npx openapi-codegen gen Api1",
"gen:Api2": "npx openapi-codegen gen Api2",
"gen:Api3": "npx openapi-codegen gen Api3",
"gen:Api4": "npx openapi-codegen gen Api4",
"gen:Api5": "npx openapi-codegen gen Api5",
"gen:Api6": "npx openapi-codegen gen Api6",
"generateAllApis": "npm run gen:Api1 && npm run gen:Api2 && npm run gen:Api3 &&  npm run gen:Api4 && npm run gen:Api5 && npm run gen:Api6"