Skip to content

Commit

Permalink
Merge pull request #328 from invopop/org-labels
Browse files Browse the repository at this point in the history
Adding and refining labels on key org structures
  • Loading branch information
samlown authored Jul 23, 2024
2 parents 07b88e9 + e0580f0 commit a5ae464
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to GOBL will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). See also the [GOBL versions](https://docs.gobl.org/overview/versions) documentation site for more details.

## [v0.110.2] - 2024-07-23

### Added

- `org.Person`: now has `label` field.

### Changed

- `org`: Refining availablility of `label` field.

## [v0.110.0] - 2024-07-23

Multiple version upgrade after merging the [gobl.cli](https://github.com/invopop/gobl.cli) project directly here instead.
Expand Down
5 changes: 4 additions & 1 deletion data/schemas/org/address.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"label": {
"type": "string",
"title": "Label",
"description": "Useful identifier, such as home, work, etc."
"description": "Useful identifier, such as home, work, etc.",
"examples": [
"Office"
]
},
"po_box": {
"type": "string",
Expand Down
16 changes: 8 additions & 8 deletions data/schemas/org/party.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"title": "UUID",
"description": "Universally Unique Identifier."
},
"label": {
"type": "string",
"title": "Label",
"description": "Label can be used to provide a custom label for the party in a given\ncontext in a single language, for example \"Supplier\", \"Host\", or similar.",
"examples": [
"Supplier"
]
},
"name": {
"type": "string",
"title": "Name",
Expand All @@ -21,14 +29,6 @@
"title": "Alias",
"description": "Alternate short name."
},
"label": {
"type": "string",
"title": "Label",
"description": "Label can be used to provide a custom label for the party in a given\ncontext in a single language, for example \"Supplier\", \"Host\", or similar.",
"examples": [
"Supplier"
]
},
"tax_id": {
"$ref": "https://gobl.org/draft-0/tax/identity",
"title": "Tax Identity",
Expand Down
8 changes: 8 additions & 0 deletions data/schemas/org/person.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"title": "UUID",
"description": "Universally Unique Identifier."
},
"label": {
"type": "string",
"title": "Label",
"description": "Label can be used to identify the person in a given context in a single\nlanguage, for example \"Attn\", \"Contact\", \"Responsible\", etc.",
"examples": [
"Attn"
]
},
"name": {
"$ref": "https://gobl.org/draft-0/org/name",
"title": "Name",
Expand Down
7 changes: 7 additions & 0 deletions data/schemas/org/registration.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"title": "UUID",
"description": "Universally Unique Identifier."
},
"label": {
"type": "string",
"title": "Label",
"examples": [
"Registration"
]
},
"capital": {
"$ref": "https://gobl.org/draft-0/num/amount",
"title": "Capital"
Expand Down
2 changes: 1 addition & 1 deletion org/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
type Address struct {
uuid.Identify
// Useful identifier, such as home, work, etc.
Label string `json:"label,omitempty" jsonschema:"title=Label"`
Label string `json:"label,omitempty" jsonschema:"title=Label,example=Office"`
// Box number or code for the post office box located at the address.
PostOfficeBox string `json:"po_box,omitempty" jsonschema:"title=Post Office Box"`
// House or building number in the street.
Expand Down
6 changes: 3 additions & 3 deletions org/party.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
// Party represents a person or business entity.
type Party struct {
uuid.Identify
// Label can be used to provide a custom label for the party in a given
// context in a single language, for example "Supplier", "Host", or similar.
Label string `json:"label,omitempty" jsonschema:"title=Label,example=Supplier"`
// Legal name or representation of the organization.
Name string `json:"name" jsonschema:"title=Name"`
// Alternate short name.
Alias string `json:"alias,omitempty" jsonschema:"title=Alias"`
// Label can be used to provide a custom label for the party in a given
// context in a single language, for example "Supplier", "Host", or similar.
Label string `json:"label,omitempty" jsonschema:"title=Label,example=Supplier"`
// The entity's legal ID code used for tax purposes. They may have other numbers, but we're only interested in those valid for tax purposes.
TaxID *tax.Identity `json:"tax_id,omitempty" jsonschema:"title=Tax Identity"`
// Set of codes used to identify the party in other systems.
Expand Down
4 changes: 4 additions & 0 deletions org/person.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
// Person represents a human, and how to contact them electronically.
type Person struct {
uuid.Identify
// Label can be used to identify the person in a given context in a single
// language, for example "Attn", "Contact", "Responsible", etc.
Label string `json:"label,omitempty" jsonschema:"title=Label,example=Attn"`
// Complete details on the name of the person
Name Name `json:"name" jsonschema:"title=Name"`
// What they do within an organization
Expand All @@ -36,6 +39,7 @@ func (p *Person) ValidateWithContext(ctx context.Context) error {
return tax.ValidateStructWithRegime(ctx, p,
validation.Field(&p.UUID),
validation.Field(&p.Name, validation.Required),
validation.Field(&p.Label),
validation.Field(&p.Emails),
validation.Field(&p.Telephones),
validation.Field(&p.Avatars),
Expand Down
2 changes: 2 additions & 0 deletions org/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
// If your country requires additional fields, please let us know.
type Registration struct {
uuid.Identify
Label string `json:"label,omitempty" jsonschema:"title=Label,example=Registration"`
Capital *num.Amount `json:"capital,omitempty" jsonschema:"title=Capital"`
Currency currency.Code `json:"currency,omitempty" jsonschema:"title=Currency"`
Office string `json:"office,omitempty" jsonschema:"title=Office"`
Expand All @@ -37,6 +38,7 @@ func (r *Registration) Validate() error {
func (r *Registration) ValidateWithContext(ctx context.Context) error {
return tax.ValidateStructWithRegime(ctx, r,
validation.Field(&r.UUID),
validation.Field(&r.Label),
validation.Field(&r.Capital),
validation.Field(&r.Currency),
validation.Field(&r.Office),
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
type Version string

// VERSION is the current version of the GOBL library.
const VERSION Version = "v0.110.1"
const VERSION Version = "v0.110.2"

// Semver parses and returns semver
func (v Version) Semver() *semver.Version {
Expand Down

0 comments on commit a5ae464

Please sign in to comment.