> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gobl.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Definition

Definition defines properties of a key, code, or other value that has a specific meaning or utility.

## Schema ID

`https://gobl.org/draft-0/cbc/definition`

## Properties

| Title       | Property  | Type                                               | Description                                                                                                                         |
| ----------- | --------- | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Key         | `key`     | [cbc.Key](/draft-0/cbc/key)                        | Key being defined.                                                                                                                  |
| Code        | `code`    | [cbc.Code](/draft-0/cbc/code)                      | Code this definition represents.                                                                                                    |
| Name        | `name`    | [i18n.String](/draft-0/i18n/string)                | Short name for the key.                                                                                                             |
| Description | `desc`    | [i18n.String](/draft-0/i18n/string)                | Description offering more details about when the key should be used.                                                                |
| Meta        | `meta`    | [cbc.Meta](/draft-0/cbc/meta)                      | Meta defines any additional details that may be useful or associated with the key.                                                  |
| Sources     | `sources` | array of [cbc.Source](/draft-0/cbc/source)         | Where the information was sourced from and where it can be reviewed for updates in the future.                                      |
| Values      | `values`  | array of [cbc.Definition](/draft-0/cbc/definition) | Values defines the possible values associated with the key, which themselves will either be keys or codes depending on the context. |
| Pattern     | `pattern` | string                                             | Pattern is used to validate the key value instead of using a fixed value from the code or key definitions.                          |
| Code Map    | `map`     | [cbc.CodeMap](/draft-0/cbc/code_map)               | Map helps map local keys to specific codes, useful for converting the described key into a local code.                              |

## Validation Rules

| Field                     | Test                                                                          | Validation Code / Message                                                               |
| ------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| <small>Definition</small> | <ul class="gobl-test"><li>String(Code) != '' \|\| string(Key) != ''</li></ul> | `GOBL-CBC-DEFINITION-02`<br />Definition must have either a key or a code, and not both |
| `name`                    | <ul class="gobl-test"><li class="gobl-test-present">Present</li></ul>         | `GOBL-CBC-DEFINITION-01`<br />Name is required                                          |
| `pattern`                 | <ul class="gobl-test"><li>Is a regexp</li></ul>                               | `GOBL-CBC-DEFINITION-03`<br />Pattern must be a valid regular expression                |
