Skip to content

Add velocity-api: the OpenAPI 3.1 contract (source of truth) - #6

Merged
wolpert merged 1 commit into
mainfrom
velocity-api
Jul 19, 2026
Merged

Add velocity-api: the OpenAPI 3.1 contract (source of truth)#6
wolpert merged 1 commit into
mainfrom
velocity-api

Conversation

@wolpert

@wolpert wolpert commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

velocity-api — the committed OpenAPI 3.1 document that is the single source of truth for the
HTTP API (AR-1). OpenAPI-first: DTOs and the Java client are generated from this yaml downstream
(openapi-generator, AR-3), so there are no hand-written DTOs to drift.

What's in it

  • velocity-engine-api.yaml (OpenAPI 3.1.0) — endpoints record / query / capabilities /
    features / purge (AR-2; FR-6/23/41), all namespace-scoped; API-key security (X-API-Key,
    P9) with namespace-scoped-authz 403 documented (NFR-21); RFC 9457 application/problem+json
    errors with 8 distinct problem types mapping to FailureCode + NFR-19/NFR-22.
  • Faithful to the frozen SPI — the wire schemas mirror the velocity-spi model exactly, including
    FeatureResult as a discriminated Success | Failure oneOf (the ADR-0009 "never a silent 0"
    branch), FeatureValue, ApplyResult/PerFeature, BackendCapabilities, Aggregation, Window.
    The validator cross-read every schema and found zero drift.
  • The record request takes raw dimensions — the service keyed-hashes them (FR-38); pre-hashed
    members correctly never appear on the wire.

Resolves OQ-D (wire money representation)

Money and every numeric value field (counts, cardinalities, sums) are JSON strings of a
decimal integer
(^-?\d+$). This matches the SPI's BigDecimal scale-0 cents and avoids
JSON-number precision loss (>2⁵³) and float coercion in generated clients. requirements §13 OQ-D is
flipped 🔴 → ✅.

Test

OpenApiSpecTest (swagger-parser) — asserts the spec parses with zero messages (not just "no
exception"), is 3.1, declares all five endpoints, money/value are integer-strings, FeatureResult is
a discriminated oneOf, and X-API-Key is global. 9 tests; would fail if an endpoint were dropped or
money became a number.

Review

Reviewed by the change-validator agent (CLAUDE.md working model): VERDICT APPROVE — valid
OpenAPI 3.1, zero SPI drift, money encoding consistent everywhere, all problem types + security
present, test not weakened. No changes required.

./gradlew :velocity-api:buildBUILD SUCCESSFUL.

🤖 Generated with Claude Code

The authoritative HTTP API document (AR-1); DTOs/clients are generated from it
downstream (openapi-generator, AR-3). OpenAPI-first — no hand-written DTOs.

- velocity-engine-api.yaml (OpenAPI 3.1.0): endpoints record/query/capabilities/
  features/purge (AR-2, FR-6/23/41), each namespace-scoped; API-key security
  (X-API-Key, P9) with namespace-scoped-authz 403 documented (NFR-21); RFC 9457
  application/problem+json errors with 8 distinct types mapping to FailureCode +
  NFR-19/NFR-22 (deadline-exceeded, overloaded, unavailable, unsupported-window, ...).
- Wire schemas faithfully mirror the frozen SPI model (FeatureResult as a
  discriminated Success|Failure oneOf — the ADR-0009 no-silent-0 branch; FeatureValue,
  ApplyResult/PerFeature, BackendCapabilities, Aggregation, Window).
- Resolves OQ-D: money AND every numeric `value` field are JSON strings of a decimal
  integer (^-?\d+$) — matches BigDecimal scale-0 cents, avoids JSON-number precision
  loss (>2^53) and float coercion in generated clients. requirements §13 OQ-D marked
  resolved.
- OpenApiSpecTest (swagger-parser): asserts the spec parses with ZERO messages, is
  3.1, declares all five endpoints, money/value are integer-strings, FeatureResult is
  a discriminated oneOf, and X-API-Key is global. 9 tests.
- build.gradle.kts: dropped unused jackson/jspecify (OpenAPI-first, no DTOs); added
  swagger-parser test-only to the catalog.

Validated by the change-validator agent: VERDICT APPROVE (zero SPI drift, valid
OpenAPI 3.1, no changes required).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wolpert
wolpert merged commit 3320292 into main Jul 19, 2026
3 checks passed
@wolpert
wolpert deleted the velocity-api branch July 19, 2026 00:54
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