vovk generate
Quick CLI Ref
$ npx vovk generate --help
Usage: vovk generate|g [options]
Generate RPC client from schema
Options:
--composed-only generate only composed client even if segmented client is enabled
--out, --composed-out <path> path to output directory for composed client
--from, --composed-from <templates...> client template names for composed client
--include, --composed-include-segments <segments...> include segments in composed client
--exclude, --composed-exclude-segments <segments...> exclude segments in composed client
--segmented-only generate only segmented client even if composed client is enabled
--segmented-out <path> path to output directory for segmented client
--segmented-from <templates...> client template names for segmented client
--segmented-include-segments <segments...> include segments in segmented client
--segmented-exclude-segments <segments...> exclude segments in segmented client
--prettify prettify output files
--force replace files at the output paths that vovk-cli did not generate
--schema, --schema-path <path> path to schema folder (default: ./.vovk-schema)
--config, --config-path <config> path to config file
--origin <url> set the origin URL for the generated client
--watch [s] watch for changes in schema or openapi spec and regenerate client; accepts a number in seconds to throttle the watcher or
make an HTTP request to the OpenAPI spec URLs
--openapi, --openapi-spec <openapi_path_or_urls...> use OpenAPI mixins for client generation
--openapi-module-name, --openapi-get-module-name <names...> module name strategies corresponding to the index of --openapi option
--openapi-method-name, --openapi-get-method-name <names...> method name strategies corresponding to the index of --openapi option
--openapi-root-url <urls...> root URLs corresponding to the index of --openapi option
--openapi-mixin-name <names...> mixin names corresponding to the index of --openapi option
--openapi-fallback <paths...> save OpenAPI spec corresponding to the index of --openapi option to a local file and use it as a fallback if URL is not
available
--log-level <level> set the log level
-h, --help display help for commandThe vovk generate command creates TypeScript, Rust, and Python clients from existing schema files and from OpenAPI mixins declared in the config. Relevant configuration spans several options and documentation pages, including:
composedClient: settings for the composed client, including the output directory, included/excluded segments, and templates.segmentedClient: settings for the segmented client, including the output directory, included/excluded segments, and templates.outputConfig: options to configureorigin, imports, OpenAPI mixins, and more.clientTemplateDefs: definitions of available templates.
See the config page for details.
In a Next.js project, a segment whose route file is gone while its schema file remains is left out of the client, with a warning; delete the schema file once the segment is removed.
Available Flags
Composed Client Flags
--composed-onlyβ generate only the composed client, even if the segmented client is enabled.--out,--composed-out <path>β overridecomposedClient.outDir.--from,--composed-from <templates...>β overridecomposedClient.templates.--include,--composed-include-segments <segments...>β overridecomposedClient.includeSegments.--exclude,--composed-exclude-segments <segments...>β overridecomposedClient.excludeSegments.
Segmented Client Flags
--segmented-onlyβ generate only the segmented client, even if the composed client is enabled.--segmented-out <path>β overridesegmentedClient.outDir.--segmented-from <templates...>β overridesegmentedClient.templates.--segmented-include-segments <segments...>β overridesegmentedClient.includeSegments.--segmented-exclude-segments <segments...>β overridesegmentedClient.excludeSegments.
OpenAPI mixin Flags
Mixins extend the sclient declared in one or more OpenAPI specs. See OpenAPI mixins.
--openapi,--openapi-spec <openapi_path_or_urls...>β use one or more OpenAPI specs (local paths or URLs). For URLs, the command fetches the spec via HTTP GET. MirrorsoutputConfig.segments.mixinName.openAPIMixin.source.url(remote) or.source.file(local).--openapi-module-name,--openapi-get-module-name <names...>β module names aligned by index with--openapi. MirrorsoutputConfig.segments.mixinName.openAPIMixin.getModuleName. Without it, a module is named after its mixin (--openapi-mixin-name petstoregivespetstore), and mixins without a name giveapi,api2, β¦--openapi-method-name,--openapi-get-method-name <names...>β method names aligned by index with--openapi. MirrorsoutputConfig.segments.mixinName.openAPIMixin.getMethodName.--openapi-root-url <urls...>β root URLs aligned by index with--openapi. MirrorsoutputConfig.segments.mixinName.openAPIMixin.apiRoot.--openapi-mixin-name <names...>β mixin names aligned by index with--openapi,mixin,mixin2, β¦ by default. In config, serves as the key inoutputConfig.segmentsand defines pseudo-segment names for the mixins.--openapi-fallback <paths...>β save OpenAPI specs to the specified paths and use them as a fallback if the URL is unavailable. Paths align by index with--openapi.--watch <s>β generate the client on start, then watch the schema or OpenAPI spec and regenerate it. Accepts a throttle interval in seconds. For remote specs, performs an HTTP request everysseconds; for local files, regenerates on change, once the changed file has stayed the same size for 300 ms.
Other Flags
--prettifyβ prettify output files with PrettierΒ . MirrorscomposedClient.prettifyClientandsegmentedClient.prettifyClient.--forceβ replace files at the output paths that vovk-cli did not generate. Without it, the command writes nothing and names those files. A file counts as generated when its first line is theGenerated by vovk-clibanner; a JSON file, which canβt hold one, when it sits beside a file with the banner. Files that a template copies as they are, or renders without the banner, are replaced either way.--schema,--schema-path <path>β override the schema folder defined byschemaOutDir.--config,--config-path <config>β override the config file path. By default, all supported filenames are checked; a warning is shown if multiple are found.--origin <url>β overrideoutputConfig.origin.--log-level <level>β set log level:trace,debug,info,warn,error,fatal(default:info).-h, --helpβ show help.
Last updated on