Skip to content

test(e2e): validate real responses against the OpenAPI schemas - #63

Merged
moveeeax merged 2 commits into
masterfrom
test/e2e-schema-validation
Aug 23, 2026
Merged

test(e2e): validate real responses against the OpenAPI schemas#63
moveeeax merged 2 commits into
masterfrom
test/e2e-schema-validation

Conversation

@moveeeax

Copy link
Copy Markdown
Owner

The gates check only (method, path) — schema bodies had no witness. Now every JSON response the e2e suite already provokes is validated against the spec.

  • tests/e2e/openapi_check.hpp (~300 lines, nlohmann-only — no new deps): the OpenAPI subset this repo actually uses (type incl. nullable arrays, required, properties, items, enum, $ref, bool additionalProperties); anything else is a logged SKIP, never a silent pass; an undocumented status is a failure.
  • Spec → JSON at authoring time (scripts/gen-openapi-json.sh, committed openapi.gen.json) with an FNV-1a-64 freshness hash the test re-computes from the yaml — regeneration drift fails with instructions. Runtime YAML parsing rejected honestly: no pyyaml/node in the test image, and a C++ yaml dep rebuilds the vcpkg world.
  • expect_matches_schema(...) wired onto every existing JSON call (17 call sites: auth flows incl. 415/422/401 branches, admin, posts, uploads, idempotency).

What it caught (all fixed on the spec side; the code told no lies):

  1. Error/ValidationError schemas lacked the status field the server always sends.
  2. The three pre-existing spectral errors on master — flow-map commas spawning phantom YAML keys — finally root-caused and fixed; make lint-openapi is 0-error for the first time.
  3. Four real-but-undocumented statuses (login 415, register 422, jobs/uploads 401) documented.
  4. POST /posts had no Post schema at all; Post, PostDetailResponse, RegisterResponse, healthz body added.

Gates + selftest 19/19 green; hash parity python↔C++ proven; the e2e run in this CI is the live proof.

@moveeeax
moveeeax merged commit 26b9657 into master Aug 23, 2026
11 checks passed
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