[Tools](https://oods-foundry.com/tools) / object_register

# `object_register`

Register an object or trait from reviewed YAML.

Generated from @oods/foundry 0.11.0

One of the 26 tools your assistant sees by default.

Use it when saving a definition; use object_registry to list, inspect or validate without writing. Returns the saved definition and registry result. overwrite replaces your own definition. Team objects may shadow shipped objects; traits cannot reuse shipped names. Relationships must name valid targets and fields. Full schema: oods\://schemas/object_register.input.json.

## Inputs

| Name | Type | Required | Description |
| - | - | - | - |
| `action` | `"register"` | yes | Choose register. |
| `yaml` | `string` | no | The whole definition as YAML: an object file starts with "object:", a trait file with "trait:" (the same format as OODS Foundry's own objects/ and traits/). Actions: register (required). See full schema for details. |
| `overwrite` | `boolean` | no | Replace a definition of yours with this name; without it a name you already registered is refused (OODS-C004). Actions: register. |

## Outputs

The package ships no output schema for this tool.

## A real call

Recorded by this site's `harbor` run, step `trait-register`, with the published OODS Foundry 0.11.0.

Its input:

```
{
  "action": "register",
  "yaml": "trait:\n  name: Stockable\n  version: 1.0.0\n  description: How full a storage location is, counted in the unit the team stores goods in.\n  category: inventory\n  tags:\n    - inventory\n    - capacity\n\nparameters:\n  - name: capacityUnit\n    type: string\n    required: false\n    description: The unit capacity and stock are counted in.\n    default: pallets\n\nschema:\n  stock_level:\n    type: string\n    required: true\n    description: Whether the location has room, is nearly full, or is full.\n    validation:\n      enum:\n        - room_available\n        - nearly_full\n        - full\n  capacity_units:\n    type: integer\n    required: true\n    description: How many units the location holds when it is full.\n    examples:\n      - 1200\n      - 800\n      - 2400\n  units_on_hand:\n    type: integer\n    required: true\n    description: How many units are stored there now.\n    examples:\n      - 640\n      - 760\n      - 2400\n\nsemantics:\n  stock_level:\n    semantic_type: inventory.stock.level\n    token_mapping: tokenMap(inventory.stock.*)\n    ui_hints:\n      component: StatusBadge\n\nview_extensions:\n  list:\n    - component: StatusBadge\n      position: after\n      props:\n        statusField: stock_level\n        emphasis: subtle\n        showIcon: false\n  card:\n    - component: StatusBadge\n      position: after\n      props:\n        statusField: stock_level\n        emphasis: subtle\n        showIcon: false\n  detail:\n    - component: StatusBadge\n      position: main\n      priority: 70\n      props:\n        statusField: stock_level\n        emphasis: subtle\n        showIcon: false\n    # Like the shipped Supersedable trait: the fields the trait is about are placed explicitly, so the detail\n    # composer's field budget never leaves them out.\n    - component: Text\n      position: main\n      priority: 69\n      props:\n        field: units_on_hand\n    - component: Text\n      position: main\n      priority: 68\n      props:\n        field: capacity_units\n\ntokens:\n  inventory.stock.tone: neutral\n\ndependencies: []\n"
}
```

Its result:

```
{
  "kind": "trait",
  "name": "Stockable",
  "file": "~/.oods-foundry/traits/Stockable.trait.yaml",
  "status": "created",
  "contexts": [],
  "warnings": [],
  "registry": {
    "folders": {
      "objects": "~/.oods-foundry/objects",
      "traits": "~/.oods-foundry/traits"
    },
    "objects": {
      "total": 16,
      "shipped": 16,
      "user": 0,
      "replacingShipped": []
    },
    "traits": {
      "total": 50,
      "shipped": 49,
      "user": 1
    },
    "issues": []
  }
}
```

[The whole call, 3 KB of JSON](https://oods-foundry.com/tools/object-register/call.json)
