feat: OpenAPI 3 spec for sidecar HTTP API#32
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/spec/openapi.yaml, generated fromutoipaannotations on the route handlers and types so the spec cannot drift from the implementation.provedex-agent --print-openapito regenerate the spec on demand.provedex-coregains anopenapifeature that addsToSchemaderives toAgentEvent,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: addutoipa(with theyamlfeature) andserde_yamlto[workspace.dependencies].crates/provedex-core: optionalutoipadep, newopenapifeature,cfg_attr(feature = "openapi", derive(utoipa::ToSchema))on the four public types.crates/provedex-agent: enablesprovedex-core/openapiunconditionally;ToSchemaonHealthandSignRequest;#[utoipa::path(...)]on each handler; newsrc/openapi.rswith the aggregatingApiDocstruct; new--print-openapiCLI flag that prints YAML and exits before tracing init.docs/spec/openapi.yaml: 338-line generated artifact, ASCII clean, regenerates deterministically.docs/integration/sidecar.mddeclares the OpenAPI spec the authoritative contract; prose examples remain illustrative.Out of scope (filed as follow-ups if needed)
/swagger-ui/route. Not landed in this PR; agent stays minimal.docs/spec/openapi.yamldrifts from--print-openapi. Easy follow-up; relies oncargo run -p provedex-agent -- --print-openapi | diff -u - docs/spec/openapi.yaml.Test plan
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-features(core 26 unit + 4 doctest, agent 7 integration, all green)cargo auditcleancargo deny checkcleancargo build -p provedex-core(no openapi feature) builds clean - feature gating workscargo run -p provedex-agent -- --print-openapiemits a valid OpenAPI 3.1 YAML doc covering 3 paths and 6 schemas--print-openapiproduces an identical file)Closes #31.