CLI reference


#Available commands

shell

#Code generation

Glue generates code from Glue files using the gen command. The generated code can be used for:

  1. Serialization/deserialization
  2. Data schemas (e.g. JSON Schema, Protobuf messages)
  3. Generating OpenAPI spec from which you can generate API clients or server stubs

Glue currently supports these languages and formats for code generation (click for more details):

  1. OpenAPI
  2. JSON Schema
  3. TypeScript (including Zod types)
  4. Python (including support for pydantic, dataclasses, attrs, and msgspec)
  5. Rust
  6. Go
  7. Protobuf

To generate code from a Glue file:

shell

#Configuration

If you have a .gluerc YAML file (or .gluerc.yaml, .gluerc.yml, .gluerc.json) at the same directory level, Glue will automatically use it for configuration. You can also specify a config file with --config path/to/config. You can also override specific config options inline with --set key=value (e.g. --set watermark=none to disable the watermark in generated code).

shell

For configurations, see Configuration.

#Static validation

Glue files can be statically validated with the check command:

shell

#Imports

Glue resolves imports recursively for both check and gen.

  • Local file inputs resolve imports relative to the importing file.
  • URL inputs resolve imports relative to the base URL.
  • Import cycles are handled safely (already-visited sources are skipped).
  • Imports must be declared at the top of the file.

#Advanced usage

#Inspect Glue IR

Glue can emit the intermediate representation (IR) it uses for code generation, which can be useful for debugging and understanding how Glue processes your files:

shell