Skip to main content

Installation (CLI)

Beside the provided sbt plugin, smithy4s can be used as a CLI. It allows generating Scala code and OpenAPI specs from smithy specs.

We recommend using coursier to install/run it.

Installation

cs install --channel https://disneystreaming.github.io/coursier.json smithy4s

Usage

The CLI comes with a number of options to customize output directories, skip openapi generation (or scala generation), provide a filter of allowed namespaces, etc. Use the --help command to get an exhaustive listing.

bash> smithy4s --help
Usage:
smithy4s generate
smithy4s dump-model
smithy4s version

Command line interface for Smithy4s

Options and flags:
--help
Display this help text.

Subcommands:
generate
Generates scala code and openapi-specs from smithy specs
dump-model
Output a JSON view of the Smithy models
version
Output the version of the CLI.

Codegen

bash> smithy4s generate --help
Usage: generate [--output <path>] [--resource-output <path>] [--skip <string>]... [--discover-models] [--allowed-ns <string,string,...>] [--excluded-ns <string,string,...>] [--repositories <string,string,...>] [--dependencies <string,string,...>] [--transformers <string,string,...>] [--local-jars <path,path,...>] [<path>...]

Generates scala code and openapi-specs from smithy specs

Options and flags:
--help
Display this help text.
--output <path>, -o <path>
Path where scala code should be generated. Defaults to pwd
--resource-output <path>
Path where non-scala files should be generated. Defaults to pwd
--skip <string>
Indicates that some files types should be skipped during generation
--discover-models
Indicates whether the model assembler should try to discover models in the classpath
--allowed-ns <string,string,...>
Comma-delimited list of namespaces that should not be processed. If unset, all namespaces are processed (except stdlib ones)
--excluded-ns <string,string,...>
Comma-delimited list of namespaces that should not be processed. If unset, all namespaces are processed (except stdlib ones)
--repositories <string,string,...>
Comma-delimited list of repositories to look in for resolving any provided dependencies
--dependencies <string,string,...>
Comma-delimited list of dependencies containing smithy files
--transformers <string,string,...>
Comma-delimited list of transformer names to apply to smithy files
--local-jars <path,path,...>
Comma-delimited list of local JAR files containing smithy files

Dump model

bash> smithy4s dump-model --help
Usage: dump-model [--repositories <string,string,...>] [--dependencies <string,string,...>] [--transformers <string,string,...>] [--local-jars <path,path,...>] [<path>...]

Output a JSON view of the Smithy models

Options and flags:
--help
Display this help text.
--repositories <string,string,...>
Comma-delimited list of repositories to look in for resolving any provided dependencies
--dependencies <string,string,...>
Comma-delimited list of dependencies containing smithy files
--transformers <string,string,...>
Comma-delimited list of transformer names to apply to smithy files
--local-jars <path,path,...>
Comma-delimited list of local JAR files containing smithy files