Skip to content

Commit

Permalink
Exporting Key and Code Definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Mar 18, 2024
1 parent 4c44573 commit 59862e2
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 86 deletions.
2 changes: 2 additions & 0 deletions cbc/cbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import "github.com/invopop/gobl/schema"
func init() {
schema.Register(schema.GOBL.Add("cbc"),
Code(""),
CodeDefinition{},
CodeMap{},
Key(""),
KeyDefinition{},
Meta{},
Note{},
)
Expand Down
37 changes: 37 additions & 0 deletions data/schemas/cbc/code-definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://gobl.org/draft-0/cbc/code-definition",
"$ref": "#/$defs/CodeDefinition",
"$defs": {
"CodeDefinition": {
"properties": {
"code": {
"$ref": "https://gobl.org/draft-0/cbc/code",
"title": "Code",
"description": "Code for which the definition is for."
},
"name": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Name",
"description": "Short name for the code, if relevant."
},
"desc": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Description",
"description": "Description offering more details about when the code should be used."
},
"meta": {
"$ref": "https://gobl.org/draft-0/cbc/meta",
"title": "Meta",
"description": "Meta defines any additional details that may be useful or associated\nwith the code."
}
},
"type": "object",
"required": [
"code"
],
"description": "CodeDefinition describes a specific code and how it maps to a human name and description if appropriate."
}
},
"$comment": "Generated with GOBL v0.68.0"
}
59 changes: 59 additions & 0 deletions data/schemas/cbc/key-definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://gobl.org/draft-0/cbc/key-definition",
"$ref": "#/$defs/KeyDefinition",
"$defs": {
"KeyDefinition": {
"properties": {
"key": {
"$ref": "https://gobl.org/draft-0/cbc/key",
"title": "Key",
"description": "Actual key value."
},
"name": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Name",
"description": "Short name for the key."
},
"desc": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Description",
"description": "Description offering more details about when the key should be used."
},
"codes": {
"items": {
"$ref": "https://gobl.org/draft-0/cbc/code-definition"
},
"type": "array",
"title": "Codes",
"description": "Codes describes the list of codes that can be used alongside the Key,\nfor example with identities."
},
"keys": {
"items": {
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Keys",
"description": "Keys is used instead of codes to define a further sub-set of keys that\ncan be used alongside this one."
},
"pattern": {
"type": "string",
"title": "Pattern",
"description": "Pattern is used to validate the key value instead of using a fixed value\nfrom the code or key definitions."
},
"map": {
"$ref": "https://gobl.org/draft-0/cbc/code-map",
"title": "Code Map",
"description": "Map helps map local keys to specific codes, useful for converting the\ndescribed key into a local code."
}
},
"type": "object",
"required": [
"key",
"name"
],
"description": "KeyDefinition defines properties of a key that is specific for a regime."
}
},
"$comment": "Generated with GOBL v0.68.0"
}
92 changes: 6 additions & 86 deletions data/schemas/tax/regime.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,6 @@
],
"description": "Category contains the definition of a general type of tax inside a region."
},
"CodeDefinition": {
"properties": {
"code": {
"$ref": "https://gobl.org/draft-0/cbc/code",
"title": "Code",
"description": "Code for which the definition is for."
},
"name": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Name",
"description": "Short name for the code, if relevant."
},
"desc": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Description",
"description": "Description offering more details about when the code should be used."
},
"meta": {
"$ref": "https://gobl.org/draft-0/cbc/meta",
"title": "Meta",
"description": "Meta defines any additional details that may be useful or associated\nwith the code."
}
},
"type": "object",
"required": [
"code"
],
"description": "CodeDefinition describes a specific code and how it maps to a human name and description if appropriate."
},
"CorrectionDefinition": {
"properties": {
"schema": {
Expand Down Expand Up @@ -149,57 +120,6 @@
],
"description": "CorrectionDefinition contains details about what can be defined in ."
},
"KeyDefinition": {
"properties": {
"key": {
"$ref": "https://gobl.org/draft-0/cbc/key",
"title": "Key",
"description": "Actual key value."
},
"name": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Name",
"description": "Short name for the key."
},
"desc": {
"$ref": "https://gobl.org/draft-0/i18n/string",
"title": "Description",
"description": "Description offering more details about when the key should be used."
},
"codes": {
"items": {
"$ref": "#/$defs/CodeDefinition"
},
"type": "array",
"title": "Codes",
"description": "Codes describes the list of codes that can be used alongside the Key,\nfor example with identities."
},
"keys": {
"items": {
"$ref": "#/$defs/KeyDefinition"
},
"type": "array",
"title": "Keys",
"description": "Keys is used instead of codes to define a further sub-set of keys that\ncan be used alongside this one."
},
"pattern": {
"type": "string",
"title": "Pattern",
"description": "Pattern is used to validate the key value instead of using a fixed value\nfrom the code or key definitions."
},
"map": {
"$ref": "https://gobl.org/draft-0/cbc/code-map",
"title": "Code Map",
"description": "Map helps map local keys to specific codes, useful for converting the\ndescribed key into a local code."
}
},
"type": "object",
"required": [
"key",
"name"
],
"description": "KeyDefinition defines properties of a key that is specific for a regime."
},
"Rate": {
"properties": {
"key": {
Expand Down Expand Up @@ -327,47 +247,47 @@
},
"tags": {
"items": {
"$ref": "#/$defs/KeyDefinition"
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Tags",
"description": "Tags that can be applied at the document level to identify additional\nconsiderations."
},
"identity_types": {
"items": {
"$ref": "#/$defs/KeyDefinition"
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Identity Types",
"description": "Identity types specific for the regime and may be validated\nagainst."
},
"extensions": {
"items": {
"$ref": "#/$defs/KeyDefinition"
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Extensions",
"description": "Extensions defines the keys that can be used for extended or extra data inside the regime that\nis specific to the regime and cannot be easily determined from other GOBL structures.\nTypically these are used to define local codes for suppliers, customers, products, or tax rates."
},
"charge_types": {
"items": {
"$ref": "#/$defs/KeyDefinition"
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Charge Types",
"description": "Charge types specific for the regime and may be validated or used in the UI as suggestions"
},
"payment_means": {
"items": {
"$ref": "#/$defs/KeyDefinition"
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Payment Means",
"description": "PaymentMeansKeys specific for the regime that extend the original\nbase payment means keys."
},
"inbox_keys": {
"items": {
"$ref": "#/$defs/KeyDefinition"
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Inbox Keys",
Expand Down

0 comments on commit 59862e2

Please sign in to comment.