NAME
Modern::OpenAPI::Generator::CLI - Command-line driver for Modern::OpenAPI::Generator (oapi-perl-gen)
SYNOPSIS
oapi-perl-gen --name MyApp::API --output ./generated openapi.yaml
oapi-perl-gen --name MyApp::API -o ./out ./spec/openapi.yaml
oapi-perl-gen --help # full manual (Pod::Usage)
oapi-perl-gen --usage # synopsis only (Pod::Usage)
OPTIONS
--name/-n(required)-
Root Perl package prefix (e.g.
MyApp::API). All generated modules use this namespace. --specFILE-
OpenAPI 3.x YAML or JSON document. You may pass the path as the first positional argument instead of
--spec. --output/-oDIR-
Output directory for the generated tree (default: current directory,
.). --sync/--no-sync-
Emit
::Client::Sync(default: on). --async/--no-async-
Emit
::Client::Async(default: on). --skeleton-
Emit server controller stubs without
TODOcomments. --local-test-
With
--server: controllers use::StubDataand::Model::*to return random data shaped like the response schema instead of HTTP 501. Also emits models when--no-clientbut server and local-test are on. --signaturehmac--signaturebearer-
Emit
::Auth::Plugin::Hmacand/or::Auth::Plugin::Bearer. Repeat the flag or pass a comma-separated list. --force-
Overwrite existing files in the output tree.
--merge-
Skip writing a file if it already exists (unless
--forceis also set). --help/-h/-?-
Print full documentation (this manual) from POD via Pod::Usage, then exit.
--usage-
Print only the synopsis section via Pod::Usage, then exit.
FEATURE SELECTION (client / server / Swagger UI)
Three independent toggles control what is emitted. Rules:
- Default
-
If your argument list contains none of:
--client,--no-client,--server,--no-server,--ui,--no-ui, then all three features are generated (full stack). - Only
--no-*flags -
Each
--no-client,--no-server, or--no-uiturns that feature off; the others stay on (example:--no-uigives client + server without embedded Swagger UI). - At least one positive flag
-
If you pass any of
--client,--server, or--ui(withoutno-), the generator starts from all-off and applies only what you set explicitly. Example:--client --serverdoes not imply--ui. - Constraint
-
At least one of client, server, or UI must remain enabled.
Examples:
--client => client only
--client --server => client + server, no UI
--client --server --ui => client + server + Swagger UI
--no-ui => client + server, no UI
--no-server --no-ui => client only
SWAGGER UI AND REQUEST ORIGIN
When server and UI are generated, GET /openapi.yaml can prepend the current request origin to servers so Swagger UI “Try it out” targets the running app. The generated script/server.pl enables this when run with --local-test at runtime, or when OAPI_SWAGGER_LOCAL_ORIGIN is set. This is separate from the oapi-perl-gen --local-test code-generation flag.
METHODS
run
Modern::OpenAPI::Generator::CLI->run(@argv)
Class method used by the oapi-perl-gen script. Parses @argv with Getopt::Long (see "OPTIONS"), applies feature flags (see "FEATURE SELECTION (client / server / Swagger UI)"), then constructs Modern::OpenAPI::Generator with the same parameters the CLI accepts and invokes ->run on it. On success, prints one line to STDOUT (Generated under ...) and returns 0.
Invalid Getopt::Long options trigger Pod::Usage with exit status 2. --help and --usage print documentation via Pod::Usage and exit 0 before generation.
DESCRIPTION
Implements the oapi-perl-gen driver: argument parsing, Pod::Usage for help, and delegation to Modern::OpenAPI::Generator. See "METHODS".
SEE ALSO
Modern::OpenAPI::Generator, Pod::Usage, the oapi-perl-gen script.
COPYRIGHT AND LICENSE
Same as Modern::OpenAPI::Generator.