Skip to content

fix: deserialize namespaced TaxNumberType and RECEIPT linked transactions - #243

Open
ryanduguid wants to merge 2 commits into
XeroAPI:masterfrom
ryanduguid:fix/deserialize-live-api-enums
Open

fix: deserialize namespaced TaxNumberType and RECEIPT linked transactions#243
ryanduguid wants to merge 2 commits into
XeroAPI:masterfrom
ryanduguid:fix/deserialize-live-api-enums

Conversation

@ryanduguid

@ryanduguid ryanduguid commented Aug 31, 2026

Copy link
Copy Markdown

Fixes #203, #205 and #206.

Contacts returned with TAXNUMBERTYPE/SSN and linked transactions returned with RECEIPT currently fail deserialization. This change normalises the exact tax-number namespace and supports the known RECEIPT value in the deserializer while preserving every other model validation error. Tests cover supported tax-number variants, unrelated invalid values and nested API response envelopes. Generated model files are unchanged.

Validation:

  • 82 deserializer tests and touched-file Flake8 pass on Python 3.8 and 3.12; the sdist builds.
  • The broader non-sandbox suite has 176 passing tests and one Windows timestamp failure, also reproduced on the unchanged PR head. Eleven mock-server tests are excluded from that run.
  • Repository-wide lint findings match the unchanged PR head.
  • Prism-dependent integration tests still require a permitted mock-server environment; local startup was blocked by execution policy.

The RECEIPT exception uses one generated backing field pending regeneration from the OpenAPI spec. Unknown future enum values continue to raise errors. Companion spec proposal: XeroAPI/Xero-OpenAPI#846.

…nums

Generated setters reject TaxNumberType TAXNUMBERTYPE/SSN (XeroAPI#203, XeroAPI#205) and
LinkedTransaction SourceTransactionTypeCode RECEIPT (XeroAPI#206). Deserialization
now retries namespaced values as their suffix, then preserves the raw API
value on the private field so one unknown enum cannot drop a valid payload.

Valid members (EIN, ACCPAY, SPEND) still go through the generated setters.
@ryanduguid
ryanduguid force-pushed the fix/deserialize-live-api-enums branch from c101441 to 85ea99b Compare September 6, 2026 10:27
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.

get_contacts tax_number_type, invalid value "TAXNUMBERTYPE/SSN"

1 participant