Skip to content

fix(ipa): handle delete request bodies in IPA-117#1339

Draft
andmatei wants to merge 1 commit into
mainfrom
fix/ipa117-delete-request-body
Draft

fix(ipa): handle delete request bodies in IPA-117#1339
andmatei wants to merge 1 commit into
mainfrom
fix/ipa117-delete-request-body

Conversation

@andmatei

@andmatei andmatei commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Fix IPA-117 DELETE request body crash

Steps to reproduce:

  • Add a DELETE operation with requestBody.content[*].
  • Run Spectral with the IPA ruleset.
  • Before this change, IPA-117 threw: Cannot read properties of null (reading startsWith).

Failing fixture before:

paths:
  /resource/{id}:
    delete:
      requestBody:
        content:
          application/vnd.atlas.2024-08-05+json:
            schema:
              type: object
      responses:
        "204":
          content:
            application/vnd.atlas.2024-08-05+json: {}

Why it failed:

  • IPA-117 evaluates both request body content and response content.
  • Request body paths do not have a response code, so httpResponseCode was null.
  • The DELETE response exemption called httpResponseCode.startsWith("2") anyway.

After this change:

  • The same fixture no longer produces an internal error.
  • A DELETE request body with a schema passes IPA-117.
  • A DELETE request body without a schema is still reported by IPA-117.

What changed:

  • Guard the DELETE 2xx response-code check with optional chaining.
  • Add regression tests for valid and invalid DELETE request bodies.

@andmatei andmatei force-pushed the fix/ipa117-delete-request-body branch 3 times, most recently from 89be753 to 7d7f593 Compare June 26, 2026 08:58
@andmatei andmatei force-pushed the fix/ipa117-delete-request-body branch from 7d7f593 to 8a7e83c Compare June 26, 2026 10:21
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