Document service_request_number placement on mailpieces - #538
Conversation
Adds a shared service_request_number attribute and references it from the postcard, letter, self mailer, and check create models (the four resources that accept it per lob-api validators). The field was previously undocumented, which led a customer to nest it inside merge_variables where the API silently ignores it — the mailpiece is created with no promotion applied and no error. The description states the field must be top-level and must not be nested in merge_variables, and the postcard create examples now include it as a sibling of size. Mirrors the USPS promotions help-center language. Follow-up to ER-515.
There was a problem hiding this comment.
Code Review
This pull request introduces a new service_request_number field across various mailpiece schemas, including checks, letters, postcards, and self-mailers, to support USPS promotions. Additionally, the failure_reason schema definitions have been updated to explicitly set the type to object and ensure nullability. The reviewer provided feedback regarding the formatting of the newly created service_request_number.yml file, suggesting the removal of redundant blank lines to improve documentation conciseness.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| the Integrated Technology promotion) to apply to this mailpiece. Supported on | ||
| letters, postcards, self mailers, and checks. | ||
|
|
||
|
|
| mailpiece is created successfully with no promotion applied and no error | ||
| returned. | ||
|
|
||
|
|
Summary
Documents
service_request_numberon the mailpiece create endpoints. The field was previously undocumented in the API reference, even though the API has accepted it for some time on letters, postcards, self mailers, and checks.Follow-up to ER-515: a customer (Wayfair) applying the USPS Integrated Technology promotion nested
service_request_numberinsidemerge_variablesinstead of at the top level of the payload. The API only reads the top-level field,merge_variablessilently accepts arbitrary keys, so the postcards were created with no promotion applied and no error returned — the CCR code never generated. With no documentation for the field, the customer had nothing to reference for correct placement.Changes
shared/attributes/service_request_number.yml— optional, nullable string. The description:size/front/back), not nested inmerge_variables.resources/postcards/models/postcard_editable.ymlresources/letters/models/letter_editable.ymlresources/self_mailers/models/self_mailer_editable.ymlresources/checks/models/check_editable_props.ymlform_factor/editable.yml, since that is also consumed by snap_packs and booklets, which do not accept the field.)service_request_numberas a sibling ofsizeacross all three request content types, so it renders in the sample payload.dist/lob-api-bundled.yml.Testing
npm run bundle— succeeds; field resolves in all four resources.npm run spectral— 0 errors.npm run pretty:check— clean.The resource contract tests (
tests/) were not run locally — they make live HTTPS calls tolob-api.lob.comand require credentials; they'll run in CI.Deploy note
This repo deploys to docs.lob.com only when a GitHub Release is created (per
.github/workflows/deploy.yml); merging tomaindoes not publish. A maintainer will need to cut a release to push these docs live.