Skip to content

fix: honor optional request bodies#921

Merged
anttiviljami merged 1 commit into
openapistack:mainfrom
kriptoburak:codex/xquik-api-key-security
Jul 25, 2026
Merged

fix: honor optional request bodies#921
anttiviljami merged 1 commit into
openapistack:mainfrom
kriptoburak:codex/xquik-api-key-security

Conversation

@kriptoburak

@kriptoburak kriptoburak commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add an OpenAPI 3.1 security fixture based on Xquik's public searchTweets contract.
  • Verify a registered apiKey handler authorizes the canonical x-api-key header.
  • Honor requestBody.required instead of inferring required bodies from media-type count.
  • Add regression coverage for omitted optional request bodies.

The request-body fix also resolves #817 and its earlier duplicate #292.

Validation

  • npm ci
  • NODE_ENV=test jest --runInBand (294 tests)
  • npm run build
  • npm run lint
  • npx prettier --check src/validation.ts src/validation.test.ts src/backend.test.ts
  • git diff --check

Add an Xquik API-key security fixture.
@kriptoburak
kriptoburak force-pushed the codex/xquik-api-key-security branch from b0208e9 to 7a8ba48 Compare July 20, 2026 04:03
@kriptoburak kriptoburak changed the title test: cover Xquik api key security fix: honor optional request bodies Jul 20, 2026
@anttiviljami

Copy link
Copy Markdown
Member

Nice, this is the right fix. The old "single media type ⇒ required" was never spec-compliant — requestBody.required defaults to false, so honoring the explicit flag is correct and closes #817/#292 properly.

Two small things:

  • it does change validation behavior for anyone leaning on the old implicit-required, so let's make sure the release notes call out that optional bodies are now honored
  • the apiKey searchTweets test is basically unrelated to the body fix — happy to keep it, but it's really its own thing. 👍

@anttiviljami
anttiviljami merged commit 025c403 into openapistack:main Jul 25, 2026
13 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.

Request validation incorrectly treats optional requestBody as required when only one content type is defined

2 participants