Allow item attributes to hold more than one value - #912
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR relaxes validation for org.Attribute so a single attribute can contain multiple related values (e.g., reference text + reference date) under one label/key/type, enabling better round-tripping for formats like FatturaPA’s AltriDatiGestionali.
Changes:
- Update
GOBL-ORG-ATTRIBUTE-02from “exactly one value” to “at least one value” across Go validation, rule JSON, and type comments. - Adjust tests so multi-value attributes are now valid and add coverage for a “text + date” (INTENTO-style) attribute.
- Document the behavior change in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| org/attribute.go | Relaxes attribute value validation and updates inline documentation to reflect multi-value support. |
| org/attribute_test.go | Updates validation tests to accept multiple value fields and adds a representative “text + date” case. |
| data/rules/org.json | Regenerates rule GOBL-ORG-ATTRIBUTE-02 description and expression to match the new >= 1 requirement. |
| CHANGELOG.md | Notes the behavioral change for org.Attribute in the Unreleased “Changed” section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #912 +/- ##
=======================================
Coverage 94.92% 94.92%
=======================================
Files 325 325
Lines 17678 17678
=======================================
Hits 16780 16780
Misses 556 556
Partials 342 342 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
An attribute required exactly one of the text, code, amount, or date
values. Some formats group related values under a single name, so the
rule now asks for at least one instead.
The case that prompted this is the FatturaPA AltriDatiGestionali block,
which may carry a reference number alongside the date it was issued:
<AltriDatiGestionali>
<TipoDato>INTENTO</TipoDato>
<RiferimentoTesto>08060120341234567-000001</RiferimentoTesto>
<RiferimentoData>2025-03-10</RiferimentoData>
</AltriDatiGestionali>
With one value per attribute, the mapping either drops the date or
splits the block into two attributes that no longer look related.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
alvarolivie
force-pushed
the
attribute-multiple-values
branch
from
July 29, 2026 11:27
64618f4 to
cbcd6d6
Compare
alvarolivie
marked this pull request as draft
July 29, 2026 11:27
alvarolivie
marked this pull request as ready for review
July 29, 2026 11:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
org: ruleGOBL-ORG-ATTRIBUTE-02relaxed from exactly one oftext,code,amount, ordateto at least one, so an attribute can group related values under a single name. An attribute with no value at all is still invalid.data/rules/org.jsonupdated to match. The JSON schema is unchanged, as it only carries the first sentence of the type description.Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: