Skip to content

feat: OpenAPI 3 spec for sidecar HTTP API#32

Merged
adi-suresh01 merged 7 commits into
mainfrom
feat/openapi-spec
May 8, 2026
Merged

feat: OpenAPI 3 spec for sidecar HTTP API#32
adi-suresh01 merged 7 commits into
mainfrom
feat/openapi-spec

Conversation

@adi-suresh01
Copy link
Copy Markdown
Contributor

Summary

  • Adds an OpenAPI 3.1 spec for the agent HTTP API at docs/spec/openapi.yaml, generated from utoipa annotations on the route handlers and types so the spec cannot drift from the implementation.
  • Adds provedex-agent --print-openapi to regenerate the spec on demand.
  • provedex-core gains an openapi feature that adds ToSchema derives to AgentEvent, SignedEvent, ChainReport, ChainStatus. Default-feature build is unaffected.

The sidecar is the cross-language SDK shim per ADR 0004. Customers in Java, Go, Ruby, Kotlin, etc. now get auto-generated clients via openapi-generator, edge validation via API gateways (Kong, Apigee, AWS), and an interactive contract for procurement reviews. The four normative specs (canonical-json, event-schema-v1, signature-scheme, ledger-format) still cover the wire format that bindings sign over; OpenAPI covers the HTTP shell on top.

What changed

  • Cargo.toml: add utoipa (with the yaml feature) and serde_yaml to [workspace.dependencies].
  • crates/provedex-core: optional utoipa dep, new openapi feature, cfg_attr(feature = "openapi", derive(utoipa::ToSchema)) on the four public types.
  • crates/provedex-agent: enables provedex-core/openapi unconditionally; ToSchema on Health and SignRequest; #[utoipa::path(...)] on each handler; new src/openapi.rs with the aggregating ApiDoc struct; new --print-openapi CLI flag that prints YAML and exits before tracing init.
  • docs/spec/openapi.yaml: 338-line generated artifact, ASCII clean, regenerates deterministically.
  • README links the spec under "Specs" alongside the four normative specs.
  • docs/integration/sidecar.md declares the OpenAPI spec the authoritative contract; prose examples remain illustrative.

Out of scope (filed as follow-ups if needed)

  • Embedded /swagger-ui/ route. Not landed in this PR; agent stays minimal.
  • CI step that fails when docs/spec/openapi.yaml drifts from --print-openapi. Easy follow-up; relies on cargo run -p provedex-agent -- --print-openapi | diff -u - docs/spec/openapi.yaml.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-features (core 26 unit + 4 doctest, agent 7 integration, all green)
  • cargo audit clean
  • cargo deny check clean
  • cargo build -p provedex-core (no openapi feature) builds clean - feature gating works
  • cargo run -p provedex-agent -- --print-openapi emits a valid OpenAPI 3.1 YAML doc covering 3 paths and 6 schemas
  • Regeneration is deterministic (re-running --print-openapi produces an identical file)
  • ASCII-only across all source + docs touched

Closes #31.

@adi-suresh01 adi-suresh01 merged commit 6b8a9d0 into main May 8, 2026
2 checks passed
@adi-suresh01 adi-suresh01 deleted the feat/openapi-spec branch May 8, 2026 05:42
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.

feat(agent): publish OpenAPI 3 spec for the sidecar HTTP API

1 participant