Bill status and support passthrough for unregistered schemas in schema.Object#796
Bill status and support passthrough for unregistered schemas in schema.Object#796
Conversation
Allow schema.Object to preserve raw JSON for schemas not registered in the GOBL registry, enabling external complement types to round-trip through GOBL documents without requiring registration. The Envelope doc field remains strict via a new validation rule (ENVELOPE-04) that requires a known schema. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #796 +/- ##
==========================================
+ Coverage 93.09% 93.20% +0.11%
==========================================
Files 368 370 +2
Lines 19624 19870 +246
==========================================
+ Hits 18269 18520 +251
+ Misses 919 913 -6
- Partials 436 437 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR expands GOBL’s document/model support by introducing bill.Status and cal.Timestamp, and updates schema.Object to allow round-trip passthrough of unregistered $schema payloads while tightening envelope validation to require a registered schema for Envelope.doc.
Changes:
- Update
schema.Objectto preserve raw JSON for unregistered schemas and addHasPayload()to distinguish resolved vs passthrough objects. - Add
bill.Statusmodel (schema + rules + tests) and new ES status examples/output fixtures. - Add
cal.Timestampmodel (schema + rules + tests) and extend CLI/envelope validation expectations (ENVELOPE-04).
Reviewed changes
Copilot reviewed 32 out of 37 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
schema/object.go |
Adds raw passthrough storage, HasPayload(), and marshaling/unmarshaling behavior changes. |
schema/object_test.go |
Updates/extends tests to cover unknown-schema passthrough, round-trip, clone, calculate, and payload detection. |
envelope.go |
Adds ENVELOPE-04 assertion requiring doc to have a known/registered schema (payload present). |
envelope_test.go |
Adds validation case for passthrough doc failing ENVELOPE-04. |
internal/cli/validate_test.go |
Updates expected error output now that unknown schemas passthrough and are rejected by envelope validation. |
internal/cli/build_test.go |
Updates expected error output for unknown-schema docs to reflect ENVELOPE-04. |
cmd/gobl/validate_test.go |
Updates expected multi-fault ordering to include ENVELOPE-04. |
internal/cli/bulk_test.go |
Updates the schema listing fixture to include new bill/status and cal/timestamp schemas. |
bill/status.go |
Introduces the bill.Status model, normalization, calculation, schema extension, and rules. |
bill/status_test.go |
Adds comprehensive tests for status calculation, validation, definitions, and schema extension. |
bill/bill.go |
Registers bill.Status schema/rules and adds ShortSchemaStatus. |
data/schemas/bill/status.json |
Adds generated JSON Schema for bill.Status and related defs. |
data/rules/bill.json |
Adds generated rules for bill.Status, StatusLine, Reason, Action, Condition. |
examples/es/status-update.yaml |
Adds ES example input for status “update”. |
examples/es/status-system.yaml |
Adds ES example input for status “system”. |
examples/es/status-system-shutdown.yaml |
Adds ES example input for a system shutdown status. |
examples/es/status-system-anomaly.yaml |
Adds ES example input including an external complement passthrough object. |
examples/es/status-response.yaml |
Adds ES example input for status “response”. |
examples/es/out/status-update.json |
Adds generated envelope output for the status-update example. |
examples/es/out/status-system.json |
Adds generated envelope output for the status-system example. |
examples/es/out/status-system-shutdown.json |
Adds generated envelope output for the shutdown example. |
examples/es/out/status-system-anomaly.json |
Adds generated envelope output for the anomaly example (includes complement passthrough). |
examples/es/out/status-response.json |
Adds generated envelope output for the status-response example. |
cal/timestamp.go |
Introduces cal.Timestamp type with JSON (un)marshal, parsing, schema, and rule scaffolding. |
cal/timestamp_test.go |
Adds tests for timestamp parsing, JSON behavior, string/clone helpers, and validation interactions. |
cal/cal.go |
Registers cal.Timestamp schema and rules. |
data/schemas/cal/timestamp.json |
Adds generated JSON Schema for cal.Timestamp. |
data/rules/cal.json |
Adds generated rules entry for cal.Timestamp. |
cal/time.go |
Adds Time.IsZero() to support ,omitzero JSON tag behavior. |
cal/time_test.go |
Adds tests for Time.IsZero() and ,omitzero marshaling. |
data/rules/gobl.json |
Adds generated envelope rule subset for ENVELOPE-04. |
data/schemas/schema/object.json |
Updates schema.Object description formatting for $schema. |
bill/ordering.go |
Updates comments to refer to “document” rather than “invoice” in shared ordering context. |
data/schemas/bill/ordering.json |
Updates generated ordering schema descriptions accordingly. |
bill/invoice.go |
Makes Invoice.CanSign() nil-safe. |
bill/invoice_test.go |
Adds tests for top-level inversion paths, Invoice.Empty(), Invoice.UnmarshalJSON edge cases, and Invoice.CanSign(). |
CHANGELOG.md |
Adds unreleased changelog entries for schema.Object passthrough, bill.Status, and cal.Timestamp. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
schema.Objectto preserve raw JSON for schemas not registered in the GOBL registry, enabling external complement types to round-trip without requiring registrationHasPayload()method to distinguish resolved objects from passthroughPre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: