CLI reference
#Available commands
#Code generation
Glue generates code from Glue files using the gen command. The generated code can be used for:
- Serialization/deserialization
- Data schemas (e.g. JSON Schema, Protobuf messages)
- 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):
- OpenAPI
- JSON Schema
- TypeScript (including Zod types)
- Python (including support for
pydantic,dataclasses,attrs, andmsgspec) - Rust
- Go
- Protobuf
To generate code from a Glue file:
#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).
For configurations, see Configuration.
#Static validation
Glue files can be statically validated with the check command:
#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: