addons

package
v0.502.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

Addons

Addons add normalization, validation rules, and scenarios that adapt a GOBL document to a specific format or regulatory regime. Each addon is identified by a versioned key (e.g. mx-cfdi-v4) that a document lists under $addons.

In-core addons

Most addons live in this directory and register themselves automatically: the blank imports in addons.go run each package's init(), which calls tax.RegisterAddonDef. Importing github.com/invopop/gobl (which imports this package) therefore makes every in-core addon available.

External addons & the approval process

An addon may instead live in its own Go module — for example github.com/invopop/gobl.fr.ctc. This keeps large, country-specific rule sets out of core and lets a project opt in only when it needs them. Mechanically an external addon is identical to an in-core one: its init() calls tax.RegisterAddonDef, so a consumer just adds a blank import:

import _ "github.com/invopop/gobl.fr.ctc/addon"
The runtime contract is strict

Listing a key under $addons requires the addon to be actually loaded at Validate/Calculate time. If the module has not been imported, validation fails with add-on must be registered. This is deliberate: a document is never silently processed without the normalizers and rules its $addons promise. Any service that handles documents for an external addon must import that module.

The approved-addon registry

So that an external addon's key is still a recognised, schema-valid $addons value even where the implementation is not compiled in, this package keeps a curated list of approved external addons in external.go, alongside the in-core addon imports. Entries on this list:

  • appear in the JSON Schema $addons enum (via AddonList.JSONSchemaExtend), and
  • record the implementing module for provenance.

Being on the approved list is recognition and governance only — it does not relax the strict runtime contract above.

Expectations of an external addon

An external addon is held to the same standards as an in-core one, plus the requirements that come with living in its own repository. Before its key is approved, the module must satisfy all of the following.

The standard addon requirements — everything expected of any GOBL addon:

  • a clear scope and a versioned key (<addon>-vN) that does not collide with an in-core addon key;
  • extensions, normalizers, scenarios, and validation rules defined in idiomatic GOBL style, with stable fault codes;
  • self-registration via init() + tax.RegisterAddonDef so a blank import is all a consumer needs;
  • a README documenting the addon's purpose, the flows/documents it covers, and how to use it.

Additional requirements for an external module:

  • Public module under github.com/invopop, importable on its own.
  • Automated linting and testing are mandatory. The repository must run golangci-lint and go test in CI (GitHub Actions) on every pull request, mirroring this repository's lint and test workflows, and the default branch must be green.
  • Status badges must be present in the module README — at least build (lint/test), code coverage, latest release tag, and Go reference — so its health is visible at a glance.
  • At least 90% test coverage is required, reported through the CI coverage pipeline (e.g. Codecov) and kept at or above that threshold.
  • Example documents for each supported flow/document, verified with the shared pkg/examples helpers (examples.Run), so behaviour is exercised end to end and stays stable.

Approval is then a reviewed pull request that adds a tax.RegisterApprovedAddon entry to external.go, once the above are met and consumers that process documents declaring the key import the module (so the strict runtime check still passes).

github.com/invopop/gobl.fr.ctc is the reference implementation of an external addon following these expectations.

Documentation

Overview

Package addons contains all the base addon packages offerd by GOBL to provide additional tax handling.

Addons are designed to use normalization and validation rules, alongside scenarios, to add support for fields and values that cannot be determined automatically or reliably from a GOBL document into the destination format, and vice versa.

Directories

Path Synopsis
ar
arca
Package arca provides the ARCA addon for Argentina.
Package arca provides the ARCA addon for Argentina.
co
dian
Package dian provides the DIAN UBL 2.1 extensions used in Colombia.
Package dian provides the DIAN UBL 2.1 extensions used in Colombia.
de
xrechnung
Package xrechnung provides extensions and validations for the German XRechnung standard version 3.0.2 for electronic invoicing.
Package xrechnung provides extensions and validations for the German XRechnung standard version 3.0.2 for electronic invoicing.
zugferd
Package zugferd adds validations and checks for successful conversion to the ZUGFeRD format.
Package zugferd adds validations and checks for successful conversion to the ZUGFeRD format.
es
facturae
Package facturae provides the FacturaE addon for Spanish invoices.
Package facturae provides the FacturaE addon for Spanish invoices.
sii
Package sii provides the SII addon
Package sii provides the SII addon
tbai
Package tbai provides the TicketBAI addon
Package tbai provides the TicketBAI addon
verifactu
Package verifactu provides the Verifactu addon
Package verifactu provides the Verifactu addon
eu
en16931
Package en16931 defines an addon that will apply rules from the EN 16931 specification to GOBL documents.
Package en16931 defines an addon that will apply rules from the EN 16931 specification to GOBL documents.
fr
choruspro
Package choruspro provides extensions and validations for the Chorus Pro standard.
Package choruspro provides extensions and validations for the Chorus Pro standard.
facturx
Package facturx provides extensions and validations for the French Factur-X standard version 1.07 for electronic invoicing.
Package facturx provides extensions and validations for the French Factur-X standard version 1.07 for electronic invoicing.
gr
mydata
Package mydata handles the extensions and validation rules in order to use GOBL with the Greek MyData format.
Package mydata handles the extensions and validation rules in order to use GOBL with the Greek MyData format.
it
sdi
Package sdi handles the extensions and validation rules in order to use GOBL with the Italian SDI and FatturaPA format.
Package sdi handles the extensions and validation rules in order to use GOBL with the Italian SDI and FatturaPA format.
ticket
Package ticket handles the validation rules in order to use GOBL with the Italian Agenzia delle Entrate format.
Package ticket handles the validation rules in order to use GOBL with the Italian Agenzia delle Entrate format.
pl
favat
Package favat provides support for the Polish KSeF FA_VAT format.
Package favat provides support for the Polish KSeF FA_VAT format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL