Skip to content

feat: add hive schema CLI command - #283

Merged
maximelb merged 2 commits into
cli-v2from
cli-v2-hive-schema
Apr 26, 2026
Merged

maximelb merged 2 commits into
cli-v2from
cli-v2-hive-schema

Conversation

@maximelb

@maximelb maximelb commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds limacharlie hive schema --hive-name <name>, mapping to the new public API endpoint GET /v1/hive/{hive_name}/schema
  • Returns the JSON Schema (draft 2020-12) describing the hive's record type, so callers can discover record structure programmatically and validate records before hive set using any standard validator (jsonschema, ajv, etc.).
  • Hives without a typed record format (dr-general, dr-managed, dr-service, fp, extension_config) surface NO_SCHEMA_AVAILABLE from the upstream RPC; unknown hives surface UNKNOWN_HIVE.

Test plan

  • Unit: tests/unit/test_sdk_hive.py::TestHiveGetSchema (URL shape, hive-name escaping)
  • Regression snapshot updated: tests/unit/test_cli_lazy_loading_regression.py — hive subcommand set now includes schema
  • Manual e2e against white-sands org:
    • hive schema --hive-name secret → returns SecretRecord schema
    • hive schema --hive-name ai_agent → returns multi-$defs schema with cross-refs
    • hive schema --hive-name lookup → richer LookupRecord + OptimizedLookup defs
    • hive schema --hive-name dr-general → NO_SCHEMA_AVAILABLE (expected)
    • hive schema --hive-name not_a_real_hive → UNKNOWN_HIVE (expected)
    • --output yaml round-trips correctly through the standard formatter
  • Schemas meta-validated against draft 2020-12 with jsonschema.Draft202012Validator.check_schema; all pass and correctly enforce required, types, and additionalProperties: false on sample records

🤖 Generated with Claude Code

maximelb and others added 2 commits April 26, 2026 07:12
Maps to the new GET /v1/hive/{hive_name}/schema endpoint that returns
the JSON Schema (draft 2020-12) describing a hive's record type. Lets
CLI users discover record structure programmatically and validate
records before calling 'hive set' with any standard JSON Schema
validator.

Hives without a typed record format (dr-*, fp, extension_config)
return NO_SCHEMA_AVAILABLE from the underlying RPC.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JWT service now returns 'user not found: ' when an API key tries to
obtain a user-scoped JWT (oid='-'). Broaden the assertion in
test_v2_org_list_accessible_orgs to also accept this phrasing so the
test stays green across backend versions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maximelb
maximelb requested a review from dzimine-lc April 26, 2026 20:13
@maximelb
maximelb merged commit 53364bf into cli-v2 Apr 26, 2026
7 checks passed
@maximelb
maximelb deleted the cli-v2-hive-schema branch April 26, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant