Work with Cumulus NVUE Config schemas
Find a file
2026-07-24 08:42:12 -06:00
cmd/nvueschema update mod -> nemith.io/nvueschema 2026-04-06 18:36:01 -06:00
testdata feat: add --affected to diff to show paths affecting a given config 2026-03-21 22:07:43 -06:00
.gitignore refactor: split cmd/library and cleanup exports 2026-03-21 20:57:03 -06:00
.golangci.yml feat: add diff and show subcommands 2026-03-21 15:55:24 -06:00
anyof_test.go fix(jsonschema): preserve recursive scalar unions 2026-07-23 19:16:54 -04:00
demo.gif chore: update demo for browse command 2026-03-24 11:47:49 -06:00
demo.tape chore: update demo for browse command 2026-03-24 11:47:49 -06:00
diff.go refactor: dry up a lot of the code 2026-03-24 11:21:44 -06:00
fetch.go fix: make caching and logging client only 2026-03-21 21:25:11 -06:00
filters.go feat: add --affected to diff to show paths affecting a given config 2026-03-21 22:07:43 -06:00
filters_test.go feat: add --affected to diff to show paths affecting a given config 2026-03-21 22:07:43 -06:00
format.go fix: improve diff accuracy for composed schemas and clean up output formatting 2026-03-21 20:58:21 -06:00
format_registry.go fix(jsonschema): don't cap key-string (SSH public key) at secret-string's 64 chars 2026-07-08 13:58:31 -04:00
go.mod update mod -> nemith.io/nvueschema 2026-04-06 18:36:01 -06:00
go.sum feat: add browse interactive tui 2026-03-24 10:57:17 -06:00
helpers.go simplify scalar union fallback 2026-07-24 10:25:01 -04:00
keystring_test.go fix(jsonschema): don't cap key-string (SSH public key) at secret-string's 64 chars 2026-07-08 13:58:31 -04:00
LICENSE chore: add LICENSE 2026-03-21 21:03:13 -06:00
output_gostruct.go refactor: dry up a lot of the code 2026-03-24 11:21:44 -06:00
output_jsonschema.go fix(jsonschema): preserve scalar unions nested in a single-branch anyOf wrapper 2026-07-08 15:44:08 -04:00
output_openapi.go refactor: split cmd/library and cleanup exports 2026-03-21 20:57:03 -06:00
output_protobuf.go refactor: dry up a lot of the code 2026-03-24 11:21:44 -06:00
output_pydantic.go refactor: dry up a lot of the code 2026-03-24 11:21:44 -06:00
output_yang.go refactor: dry up a lot of the code 2026-03-24 11:21:44 -06:00
parser.go fix: prune action only nodes 2026-03-21 22:07:43 -06:00
README.md chore: Add README.md 2026-03-21 20:57:03 -06:00
schema.go refactor: dry up a lot of the code 2026-03-24 11:21:44 -06:00
show.go refactor: dry up a lot of the code 2026-03-24 11:21:44 -06:00

nvueschema

Fetch the configuration schema from Cumulus Linux NVUE OpenAPI specs and view, diff, validate, or convert them to other formats.

demo

This tool exists because the only schema Nvidia provides is a full OpenAPI spec including all API endpoints, which makes it harder to reason about or validate just the configuration.

Install

go install github.com/nemith/nvueschema/cmd/nvueschema@latest

Usage

Anywhere a spec is expected, you can pass a version number instead of a file path. Specs are cached locally in ~/.cache/nvueschema and validated with If-Modified-Since. Use --no-cache to skip the cache.

# Download the 5.16 spec from Nvidia and save it as spec.json
nvueschema fetch 5.16 -o spec.json

# Show a tree of all the `bridge` options in the 5.16 spec
nvueschema show 5.16 --path bridge

# Show a tree of differences between version 5.14 to 5.16
nvueschema diff 5.14 5.16

# Show a flat (one change per line) differences between 5.15 and 5.16 only for the interface top-level
nvueschema diff 5.15 5.16 --path interface -O flat

# Validate that the config.yaml file is valid for version 5.16
nvueschema validate 5.16 config.yaml

# Generate different config schemas
nvueschema gen -f pydantic 5.16 -o nvue.py
nvueschema gen -f yang 5.14
nvueschema gen -f proto --validate 5.16
nvueschema gen -f go 5.16 -o nvue.go

Output formats

The supported output schemas for the gen command.

Format Flag Notes
JSON Schema jsonschema, js Draft 2020-12 with $defs for format types
Pydantic pydantic, py v2 models with Field(pattern=...) validation
YANG yang Module with typedefs, inet: types, leaf-list
OpenAPI openapi, oas Minimal 3.1 spec, config schema only
Go go, golang Structs with json/yaml tags, net/netip types
Protobuf protobuf, proto Proto3 messages, optional --validate for buf protovalidate

All formats include pattern-validated types for MAC addresses, interface names, route distinguishers, BGP communities, etc.

Library

You can also use the Go package directly.

import nvue "github.com/nemith/nvueschema"

p, _ := nvue.NewParser(reader)
cfg, _ := p.ConfigSchema()

// Generate
nvue.WriteYANG(os.Stdout, cfg, p.Info())

// Diff
diff := nvue.DiffSchemas(oldCfg, newCfg, "")
for _, c := range diff.Changes {
    fmt.Println(c.Kind, c.Path)
}

// Validate
doc := cfg.JSONSchemaDoc()