Skip to content

feat(ir): add webhook body param sort specification to CLI and IR#13623

Open
iamnamananand996 wants to merge 5 commits intomainfrom
devin/1773750173-add-webhook-body-sort
Open

feat(ir): add webhook body param sort specification to CLI and IR#13623
iamnamananand996 wants to merge 5 commits intomainfrom
devin/1773750173-add-webhook-body-sort

Conversation

@iamnamananand996
Copy link
Contributor

@iamnamananand996 iamnamananand996 commented Mar 17, 2026

Description

Linear ticket: Refs FER-8930

Adds a body-sort option to WebhookPayloadFormat so that POST body parameters can be sorted alphabetically by key before concatenation into the signing payload. This is required by providers like Twilio.

Changes Made

  • IR schema: Add optional bodySort field (WebhookPayloadBodySort enum with ALPHABETICAL) to WebhookPayloadFormat
  • OpenAPI IR schema: Mirror the same field/enum (lowercase alphabetical)
  • Fern Definition schema: Add body-sort field and WebhookPayloadBodySortSchema enum
  • Regenerated TypeScript types for all three schemas (pnpm ir:generate, fern generate --local)
  • Regenerated JSON schemas (fern.schema.json, package-yml.schema.json, and lazy-fern-workspace copies) via pnpm definition-yml:jsonschema and pnpm package-yml:jsonschema
  • OpenAPI parser (getFernWebhookSignatureExtension.ts): Parse body-sort from x-fern-webhook-signature extension's payload-format block
  • IR generator (convertWebhookGroup.ts): Pass bodySort through in convertPayloadFormat
  • OpenAPI IR→Fern converter (buildWebhooks.ts): Convert bodySort back to body-sort
  • Test fixture & snapshots: Updated x-fern-webhook-signature fixture with body-sort: alphabetical, regenerated OpenAPI IR snapshots, Fern definition snapshots, ETE IR snapshot, and IR generator test snapshots (webhooks.json, audiences.json, environmentAudiences.json)
  • CLI changelog: v4.32.0 feat entry

Note: The exhaustive.json snapshot diffs (both ir/__test__/test-definitions/exhaustive.json and dynamic-snippets/__test__/test-definitions/exhaustive.json) are pre-existing changes from main (renaming getAndReturnWithDocumentedUnknownTypegetAndReturnMapOfDocumentedUnknownType and adding MapOfDocumentedUnknownType). They are unrelated to this feature and were picked up during snapshot regeneration.

IR Migration (v65→v63)

No migration changes needed — the existing v65→v63 migration already strips signatureVerification entirely from webhooks, so the nested bodySort field is implicitly removed.

Human Review Checklist

  • Verify the v65→v63 migration correctly handles the new bodySort field (it strips signatureVerification entirely, so bodySort inside WebhookPayloadFormat should be dropped)
  • convertBodySort in getFernWebhookSignatureExtension.ts has no default case (relying on TS exhaustiveness), while buildWebhooks.ts has default: return undefined. Confirm this inconsistency is acceptable or align them
  • ETE and IR generator test snapshots show "bodySort": null for webhooks that don't set body-sort — confirm this is expected (JSON serialization of undefinednull)
  • Verify convertPayloadFormat in convertWebhookGroup.ts now passes bodySort: undefined in the default (null payloadFormat) branch — confirm this doesn't break downstream consumers
  • Confirm the unrelated exhaustive.json snapshot diffs (IR + dynamic-snippets) are safe to include

Testing

  • pnpm run check (biome lint/format) passes locally
  • Snapshot files updated for x-fern-webhook-signature fixture (OpenAPI IR + Fern definition)
  • ETE IR snapshot regenerated via vitest --update for webhooks test
  • IR generator test snapshots regenerated (webhooks.json, audiences.json, environmentAudiences.json)
  • JSON schema files regenerated (fern.schema.json, package-yml.schema.json)
  • CI seed tests (prior failures were Docker Hub 504 Gateway Time-out, not code-related)

Link to Devin session: https://app.devin.ai/sessions/b8c7736ece704d12b0bec3014be4bc84
Requested by: @iamnamananand996

Add body-sort specification to WebhookPayloadFormat across the CLI and IR stack.
When set to 'alphabetical', POST body parameters are sorted by key before
being concatenated into the signing payload (required by providers like Twilio).

Changes:
- IR schema: add bodySort field to WebhookPayloadFormat, new WebhookPayloadBodySort enum
- OpenAPI IR schema: add bodySort field and enum
- Fern Definition schema: add body-sort field and enum
- Regenerate TypeScript types for all three schemas
- OpenAPI parser: parse body-sort from x-fern-webhook-signature extension
- IR generator: pass bodySort through in convertPayloadFormat
- OpenAPI IR-to-Fern converter: convert bodySort in convertPayloadFormat
- Update test fixtures and snapshots
- Add CLI changelog entry (v4.32.0)
@claude
Copy link

claude bot commented Mar 17, 2026

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Contributor

🌱 Seed Test Selector

Select languages to run seed tests for:

  • Python
  • TypeScript
  • Java
  • Go
  • Ruby
  • C#
  • PHP
  • Swift
  • Rust
  • OpenAPI
  • Postman

How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR.

@devin-ai-integration devin-ai-integration bot changed the title feat: add webhook body param sort specification to CLI and IR feat(ir): add webhook body param sort specification to CLI and IR Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant