Skip to content

fix: accept a custom-field create response with no object field - #41

Merged
priosshrsth merged 1 commit into
mainfrom
fix/custom-field-create-response-omits-object
Aug 24, 2026
Merged

fix: accept a custom-field create response with no object field#41
priosshrsth merged 1 commit into
mainfrom
fix/custom-field-create-response-omits-object

Conversation

@priosshrsth

Copy link
Copy Markdown
Collaborator

POST /v1/custom-fields omits object from the fields it echoes back, though GET includes it and the API reference documents it on both. CustomFieldSchema requires it, so a successful create threw AssemblyResponseParseError after the field existed.

That's a bad failure mode for this endpoint in particular: the API has no delete for custom fields, so a caller who sees the throw and retries ends up with an undeletable duplicate. Hit for real while creating company-level fields for OUT-4090.

Actual response body, verbatim:

{"customFields":[{"id":"388ac3ed-dbb3-45c4-823d-3f847a35f706","key":"propertyType",
  "name":"Property Type","type":"multiSelect","order":3,
  "options":[{"id":"option-8dfa39d0-…","key":"hotel","label":"Hotel","color":"rgba(144, 149, 157, 1)"}],
  "entityType":"company"}]}

What to look at

  • src/lib/modules/custom-fields/schema.tsobject is optional on the new CreatedCustomFieldSchema only; CustomFieldSchema still requires it so list keeps the guarantee. Shape extracted to customFieldShape following the clientShape precedent in the clients module.
  • CustomFieldsCreateResponse.customFields changes from CustomField[] to CreatedCustomField[]. A type widening — reads of .object still compile, but anyone assigning the result to CustomField[] will need a narrow. Worth a look if that's a breaking concern pre-1.0.
  • CustomFieldOptionSchema needed no change; it never declared object, which is why list validated despite options omitting it too.

Verified / not verified

vp check clean, 200 tests pass. Confirmed the fix is load-bearing: reverting just the schema fails exactly one of the new tests. The create-response fixture is copied verbatim from a real API call, not hand-written.

Not verified: whether the omission is intentional or an API bug. If it's a bug, this should be reverted once the API sends the field — both the schema and the README note say so.

🤖 Generated with Claude Code

POST /v1/custom-fields omits `object` from the fields it echoes back, though GET
includes it and the API reference documents it on both. CustomFieldSchema
requires it, so a successful create threw AssemblyResponseParseError *after* the
field existed — and the API has no delete for custom fields, so retrying left an
undeletable duplicate behind.

The create response now parses through CreatedCustomFieldSchema, where `object`
is optional. CustomFieldSchema keeps requiring it so list responses don't lose
the guarantee. Revert both once the API sends the field.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@priosshrsth
priosshrsth merged commit 047f0d5 into main Aug 24, 2026
5 checks passed
@priosshrsth
priosshrsth deleted the fix/custom-field-create-response-omits-object branch August 24, 2026 07:25
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