Skip to content

Replace schema command output with runtime JSON schema contract #17

@ggonzalez94

Description

@ggonzalez94

Summary

Replace defi schema [command path] output with runtime output JSON schema (envelope + command data shape), even though this is a breaking change for current schema consumers.

Problem

Current schema output describes command/flag metadata, not the response contract. Agents and typed clients still need to infer runtime output shapes manually.

Proposal

  • Make defi schema [command path] return JSON Schema for that command's runtime output.
  • Include:
    • full envelope schema (version/success/data/error/warnings/meta)
    • data item schema for the selected command
    • explicit optional fields for provider-specific extras (for example execution IDs / fee breakdown fields)
  • Keep deterministic field ordering expectations documented separately.

Breaking-change note

This intentionally changes the shape returned by defi schema.

Acceptance criteria

  1. defi schema yield opportunities returns JSON Schema (Draft 2020-12) for the output contract, not Cobra command metadata.
  2. Schema includes both success and error envelope shapes.
  3. Schema covers provider-optional fields already in contract (e.g. provider_native_id, market_address, fee_breakdown).
  4. Tests validate schema generation for at least one command in each major domain (lend, yield, bridge, swap).
  5. README/AGENTS updated to describe the new schema behavior and breaking change.

Implementation notes

Prefer generating schema from model types + command response wrappers to minimize maintenance drift.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions