Skip to content

Fix TypeError: Change setter types to nullable for reference classes#156

Merged
brtdv merged 1 commit intonum-num:masterfrom
TNAJanssen:fix/nullable-setter-types
Jan 14, 2026
Merged

Fix TypeError: Change setter types to nullable for reference classes#156
brtdv merged 1 commit intonum-num:masterfrom
TNAJanssen:fix/nullable-setter-types

Conversation

@TNAJanssen
Copy link
Copy Markdown

Summary

  • Fix TypeError when parsing UBL files with missing optional ID elements
  • The xmlDeserialize methods pass null values (via ?? null) to setters when optional XML elements are missing or empty
  • Updated setter/getter types to nullable in OrderReference, ProjectReference, ContractDocumentReference, and InvoiceDocumentReference

Changes

  • OrderReference::setId() and getId() now accept/return ?string
  • ProjectReference::setId() and getId() now accept/return ?string
  • ContractDocumentReference::setId() and getId() now accept/return ?string
  • InvoiceDocumentReference::setOriginalInvoiceId() now accepts ?string

Test plan

  • All existing tests pass (29 tests, 78 assertions)
  • Verified nullable types are consistent with other similar classes (e.g., DespatchDocumentReference, OriginatorDocumentReference)

The xmlDeserialize methods pass null values (via ?? null) to setters
when optional XML elements are missing or empty. This caused TypeErrors
when parsing UBL files with missing optional ID fields.

Changes:
- OrderReference::setId() now accepts ?string
- OrderReference::getId() now returns ?string
- ProjectReference::setId() now accepts ?string
- ProjectReference::getId() now returns ?string
- ContractDocumentReference::setId() now accepts ?string
- ContractDocumentReference::getId() now returns ?string
- InvoiceDocumentReference::setOriginalInvoiceId() now accepts ?string
@brtdv brtdv merged commit 9ed74f5 into num-num:master Jan 14, 2026
5 checks passed
@brtdv
Copy link
Copy Markdown
Contributor

brtdv commented Jan 14, 2026

Thanks @TNAJanssen! 🙏

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.

2 participants