Jesús Pérez a395bd972f
Some checks failed
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
mdBook Build & Deploy / Build mdBook (push) Has been cancelled
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
mdBook Build & Deploy / Documentation Quality Check (push) Has been cancelled
mdBook Build & Deploy / Deploy to GitHub Pages (push) Has been cancelled
mdBook Build & Deploy / Notification (push) Has been cancelled
chore: add cd/ci ops
2026-01-12 03:36:55 +00:00

1.3 KiB

Platform Validators

Reusable validation functions for configuration values.

Validators

Port Validator (port-validator.ncl)

Validates port numbers:

  • Valid range: 1024-65535 (excludes system ports < 1024)
  • Checks for unreserved ports
  • Predicate functions for validation

Functions:

  • is_valid_port(port) - Returns bool
  • is_unreserved_port(port) - Returns bool
  • validate_port(port) - Returns {valid, error}
  • is_system_port(port) - Returns bool

Budget Validator (budget-validator.ncl)

Validates cost tracking configuration:

  • Role budget limits (must be > 0)
  • Threshold percentages (0-100)
  • Budget windows (daily/weekly/monthly)
  • Complete budget limit validation

Functions:

  • is_valid_budget(cents) - Returns bool
  • is_valid_threshold(percent) - Returns bool
  • is_valid_window(window) - Returns bool
  • validate_role_limits(limits) - Returns {valid, errors}
  • validate_threshold(percent) - Returns {valid, error}

Usage Pattern

let port_validator = import "validators/port-validator.ncl" in

assert port_validator.is_valid_port 8080

let result = port_validator.validate_port 9001
if result.valid then
  "Port OK"
else
  "Port error: %{result.error}"

References

  • Parent: ../README.md
  • Constraints: ../constraints/README.md
  • Values: ../values/README.md