amalgam

Crates.ioamalgam
lib.rsamalgam
version0.6.4
created_at2025-08-28 10:50:41.888475+00
updated_at2025-09-01 23:47:54.391155+00
descriptionType-safe configuration generator for Nickel from various schema sources
homepagehttps://github.com/seryl/amalgam
repositoryhttps://github.com/seryl/amalgam
max_upload_size
id1814013
size176,900
Josh Toft (seryl)

documentation

https://docs.rs/amalgam

README

amalgam

Type-safe configuration generator for Nickel from various schema sources.

Overview

amalgam is a command-line tool that generates type-safe Nickel configurations from Kubernetes CRDs, OpenAPI specifications, Go types, and other schema sources.

Installation

cargo install amalgam

Or with Nix:

nix run github:seryl/amalgam

Usage

Import Kubernetes CRDs

# Import from live cluster
amalgam k8s-import --context production --output ./k8s-types

# Import specific CRD
amalgam k8s-import --crd cert-manager.io --output ./cert-manager

# Import from file
amalgam import --input my-crd.yaml --output ./types

Convert OpenAPI to Nickel

amalgam import --input openapi.yaml --output ./api-types --format nickel

Generate Go structs from Nickel

amalgam export --input config.ncl --output types.go --format go

Watch mode

# Watch for changes and regenerate
amalgam watch --input ./schemas --output ./generated

Features

  • Multi-format Support: OpenAPI, Kubernetes CRDs, JSON Schema, Go AST
  • Bidirectional: Import to Nickel, export from Nickel
  • Type Safety: Generates contracts and validation
  • Dependency Resolution: Automatic import management
  • Incremental: Only regenerates changed schemas

Configuration

Create an amalgam.toml file:

[input]
paths = ["./schemas", "./crds"]
watch = true

[output]
path = "./generated"
format = "nickel"

[kubernetes]
enabled = true
context = "default"
namespaces = ["default", "kube-system"]

Examples

See the examples directory for sample configurations and generated types.

Commit count: 37

cargo fmt