From c89d21a903def7d5403c62fffe9243e7719c51a7 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Thu, 21 Nov 2019 22:09:08 -0500 Subject: [PATCH] [cli][doc] Document batch command (#4572) * [cli][batch] Better glob support If invoked as `openapi-generator batch *.yaml`, the command might previously fail in some shells where `*.yaml` expands to file name only. This supports globs without path-part in the filename to prevent possible NPE. * [cli] Document batch command --- docs/usage.md | 82 +++++++++++++++++++ .../codegen/cmd/GenerateBatch.java | 29 ++++--- 2 files changed, 100 insertions(+), 11 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 3ee12db6824..d7fd3092b1d 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -557,3 +557,85 @@ The name of the file should be `config.yml` or `config.yaml` (in our example it openapi-generator generate -i petstore.yaml -g typescript-fetch -o out \ -c config.yaml ``` + + +## batch + +The `batch` command allows you to move all CLI arguments supported by the `generate` command into a YAML or JSON file. + +*NOTE*: This command supports an additional `!include` property which may point to another "shared" file, the base path to which can be +modified by `--includes-base-dir`. + +```bash +openapi-generator help batch +NAME + openapi-generator-cli batch - Generate code in batch via external + configs. + +SYNOPSIS + openapi-generator-cli batch [--fail-fast] + [--includes-base-dir ] [(-r | --threads )] + [--root-dir ] [--timeout ] [(-v | --verbose)] [--] + ... + +OPTIONS + --fail-fast + fail fast on any errors + + --includes-base-dir + base directory used for includes + + -r , --threads + thread count + + --root-dir + root directory used output/includes (includes can be overridden) + + --timeout + execution timeout (minutes) + + -v, --verbose + verbose mode + + -- + This option can be used to separate command-line options from the + list of argument, (useful when arguments might be mistaken for + command-line options + + + Generator configuration files. +``` + +Example: + +```bash +# create "shared" config +mkdir shared && cat > shared/common.yaml < kotlin.yaml < csharp.yaml <