feat(ir): add webhook body param sort specification to CLI and IR#13623
Open
iamnamananand996 wants to merge 5 commits intomainfrom
Open
feat(ir): add webhook body param sort specification to CLI and IR#13623iamnamananand996 wants to merge 5 commits intomainfrom
iamnamananand996 wants to merge 5 commits intomainfrom
Conversation
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)
|
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. |
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
🌱 Seed Test SelectorSelect languages to run seed tests for:
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Linear ticket: Refs FER-8930
Adds a
body-sortoption toWebhookPayloadFormatso 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
bodySortfield (WebhookPayloadBodySortenum withALPHABETICAL) toWebhookPayloadFormatalphabetical)body-sortfield andWebhookPayloadBodySortSchemaenumpnpm ir:generate,fern generate --local)fern.schema.json,package-yml.schema.json, and lazy-fern-workspace copies) viapnpm definition-yml:jsonschemaandpnpm package-yml:jsonschemagetFernWebhookSignatureExtension.ts): Parsebody-sortfromx-fern-webhook-signatureextension'spayload-formatblockconvertWebhookGroup.ts): PassbodySortthrough inconvertPayloadFormatbuildWebhooks.ts): ConvertbodySortback tobody-sortx-fern-webhook-signaturefixture withbody-sort: alphabetical, regenerated OpenAPI IR snapshots, Fern definition snapshots, ETE IR snapshot, and IR generator test snapshots (webhooks.json,audiences.json,environmentAudiences.json)IR Migration (v65→v63)
No migration changes needed — the existing v65→v63 migration already strips
signatureVerificationentirely from webhooks, so the nestedbodySortfield is implicitly removed.Human Review Checklist
bodySortfield (it stripssignatureVerificationentirely, sobodySortinsideWebhookPayloadFormatshould be dropped)convertBodySortingetFernWebhookSignatureExtension.tshas nodefaultcase (relying on TS exhaustiveness), whilebuildWebhooks.tshasdefault: return undefined. Confirm this inconsistency is acceptable or align them"bodySort": nullfor webhooks that don't setbody-sort— confirm this is expected (JSON serialization ofundefined→null)convertPayloadFormatinconvertWebhookGroup.tsnow passesbodySort: undefinedin the default (null payloadFormat) branch — confirm this doesn't break downstream consumersexhaustive.jsonsnapshot diffs (IR + dynamic-snippets) are safe to includeTesting
pnpm run check(biome lint/format) passes locallyx-fern-webhook-signaturefixture (OpenAPI IR + Fern definition)vitest --updatefor webhooks testwebhooks.json,audiences.json,environmentAudiences.json)fern.schema.json,package-yml.schema.json)504 Gateway Time-out, not code-related)Link to Devin session: https://app.devin.ai/sessions/b8c7736ece704d12b0bec3014be4bc84
Requested by: @iamnamananand996