Skip to content

Map every AltriDatiGestionali reference to a single attribute - #78

Open
rilla wants to merge 3 commits into
mainfrom
attribute-multiple-values
Open

Map every AltriDatiGestionali reference to a single attribute#78
rilla wants to merge 3 commits into
mainfrom
attribute-multiple-values

Conversation

@rilla

@rilla rilla commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Context

A FatturaPA AltriDatiGestionali block can carry RiferimentoTesto, RiferimentoNumero and RiferimentoData at the same time — the XSD declares them as optional siblings, not a choice. Blocks in the wild rely on it: INTENTO pairs the declaration protocol with the AdE receipt date, and CASSA-PREV pairs the fund name with the contribution amount.

org.Attribute used to hold exactly one value, so the mapping had to pick one reference and drop the others. invopop/gobl#912 relaxed that rule to at least one, released in v0.504.0, which lets a block and an attribute correspond one to one in both directions.

Changes

  • Export: an attribute's text or code, amount and date now each fill their own reference field in the same block, instead of a switch taking whichever came first. Text and code still share RiferimentoTesto, so text wins when both are set.
  • Import: every reference in a block lands in the same attribute, replacing the date-over-number-over-text priority. A reference that fails to parse is still preserved as text, but only while the text is free.
  • Bumped GOBL to v0.504.0. That release also changed pay.CreditTransfer's IBAN and BIC to cbc.Code, so their call sites are adapted in the same commit to keep the tree building.
  • The despatch example now carries a batch code and its expiry in one block, alongside the existing separate blocks, so both shapes are visible. Its XML is checked against the FatturaPA 1.2.2 XSD by the example tests.

@rilla
rilla marked this pull request as ready for review August 6, 2026 16:04
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