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
--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 URL
--openapi, --openapi-spec <openapi_path_or_urls...> use OpenAPI schema for client generation
--openapi-module-name, --openapi-get-module-name <names...> module names corresponding to the index of --openapi option
--openapi-method-name, --openapi-get-method-name <names...> method names 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 and use it as a fallback if URL is not available
--log-level <level> set the log level
-h, --help display help for command
The vovk generate
command generates TypeScript, Rust, and Python RPC clients from existing schema files that by default are located in the .vovk-schema
folder. It can be configured in the config file but also overridden with some of the CLI flags. The configuration settings are spread across multiple config options as well as pages of this documentation, such as:
composedClient
- settings for the composed client, where you can define the output directory, included/excluded segments, and list of used templates.segmentedClient
- settings for the segmented client, where you can define the output directory, included/excluded segments, and list of used templates.generatorConfig
- list of options that allows you to configureorigin
, imports, OpenAPI mixins, and more.clientTemplateDefs
- definitions of available templates for client generation.
You can refer to the config page for more details on how to configure these options.
Available Flags
Composed Client Flags
--composed-only
- generate only the composed client even if the segmented client is enabled in the config.--out
,--composed-out <path>
- override the output directory for the composed client defined incomposedClient.outDir
.--from
,--composed-from <templates...>
- override the list of templates for the composed client defined incomposedClient.templates
.--include
,--composed-include-segments <segments...>
- override the list of included segments for the composed client defined incomposedClient.includeSegments
.--exclude
,--composed-exclude-segments <segments...>
- override the list of excluded segments for the composed client defined incomposedClient.excludeSegments
.
Segmented Client Flags
--segmented-only
- generate only the segmented client even if the composed client is enabled in the config.--segmented-out <path>
- override the output directory for the segmented client defined insegmentedClient.outDir
.--segmented-from <templates...>
- override the list of templates for the segmented client defined insegmentedClient.templates
.--segmented-include-segments <segments...>
- override the list of included segments for the segmented client defined insegmentedClient.includeSegments
.--segmented-exclude-segments <segments...>
- override the list of excluded segments for the segmented client defined insegmentedClient.excludeSegments
.
OpenAPI Mixin Flags
Mixins are used to extend the schema with additional endpoints defined in one or more OpenAPI specs. You can read more about them on the OpenAPI Mixins page.
--openapi
,--openapi-spec <openapi_path_or_urls...>
- use one or more OpenAPI specs for client generation. It accepts either a path to a local file or a URL. If a URL is provided, the command makes an HTTP GET request to fetch the spec. Can be replicated in the config optiongeneratorConfig.segments.mixinName.openAPIMixin.source.url
for remote specs orgeneratorConfig.segments.mixinName.openAPIMixin.source.file
for local files.--openapi-module-name
,--openapi-get-module-name <names...>
- list of module names corresponding to the index of the--openapi
option. Allows you to pass a string value that can be replicated in the config optiongeneratorConfig.segments.mixinName.openAPIMixin.getModuleName
.--openapi-method-name
,--openapi-get-method-name <names...>
- list of method names corresponding to the index of the--openapi
option. Allows you to pass a string value that can be replicated in the config optiongeneratorConfig.segments.mixinName.openAPIMixin.getMethodName
.--openapi-root-url <urls...>
- list of root URLs corresponding to the index of the--openapi
option. Allows you to pass a string value that can be replicated in the config optiongeneratorConfig.segments.mixinName.openAPIMixin.apiRoot
.--openapi-mixin-name <names...>
- list of mixin names corresponding to the index of the--openapi
option. Defines a name of a pseudo-segment that will be used in the generated client. In the config, it’s defined as the key in thegeneratorConfig.segments
object.--openapi-fallback <paths...>
- save one or more OpenAPI specs to the specified paths and use them as a fallback if the URL is not available. It accepts paths to local files that correspond to the index of the--openapi
option.--watch <s>
- watch for changes in the schema or OpenAPI spec and regenerate the client. It accepts a number in seconds to throttle the watcher or make an HTTP request to the OpenAPI spec URL everys
seconds or when the local file changes.
Other Flags
--prettify
- prettify the output files using Prettier . Can be configured in the config optioncomposedClient.prettifyClient
andsegmentedClient.prettifyClient
.--schema
,--schema-path <path>
- override the path to the schema folder defined inschemaOutDir
.--config
,--config-path <config>
- override the path to the config file. By default, it reads all combinations of allowed config file names and gives a warning if more than one file is found.--origin <url>
- override theorigin
defined ingeneratorConfig.origin
.--log-level <level>
- set the log level. Available levels are:trace
,debug
,info
,warn
,error
,fatal
. By default, it’s set toinfo
.-h, --help
- display help for the command.
Last updated on