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

# `object_import`

Draft objects from local OpenAPI, JSON Schema, Postgres DDL/migrations, Prisma, dbt, OData or GraphQL files.

Generated from @oods/foundry 0.10.1

One of the 20 tools your assistant sees by default.

Use it when importing a schema you already have; use object_registry for hand-written object/trait YAML. Returns an importId, staged drafts/report, counts and a re-import diff. action=draft uses source.path or source.content without registering; show uses importId and object for YAML, graded proposals and unmapped elements; apply uses importId and explicit objects with accepted proposal ids. The batch validates and composes with rollback. overwrite replaces team objects; confirmShipped names each approved shipped replacement. Unreachable references are reported and skipped; no network fetch or code execution. Reference: TOOL-REFERENCE.md#object_import; full schema: oods\://schemas/object_import.input.json.

## Inputs

| Name | Type | Required | Description |
| - | - | - | - |
| `action` | `"draft" \| "show" \| "apply"` | yes | Draft files without registration; show one draft; apply explicitly accepted objects and proposals. |
| `source` | `object` | no | Local file/folder or inline schema. Used only by draft. |
| `importId` | `string` | no | Content-addressed import id from draft. Required by show and apply. |
| `object` | `string` | no | Exact draft object name for show. |
| `objects` | `object[]` | no | Explicit accepted object names and optional proposal ids for apply. |
| `overwrite` | `boolean` | no | Allow replacing existing team objects. |
| `confirmShipped` | `string[]` | no | Each shipped object name whose replacement is explicitly confirmed. |

## Outputs: draft

| Name | Type | Required | Description |
| - | - | - | - |
| `action` | `"draft"` | yes | |
| `importId` | `string` | yes | |
| `directory` | `string` | yes | |
| `contentHash` | `string` | yes | |
| `counts` | `object` | yes | |
| `objectCount` | `integer` | yes | |
| `objects` | `string[]` | yes | |
| `objectsTruncated` | `boolean` | yes | |
| `shippedClashes` | `string[]` | yes | |
| `diff` | `object` | yes | |
| `proposalGrades` | `object` | yes | |
| `cycleCount` | `integer` | yes | |
| `files` | `object` | yes | |
| `proposalTraits` | `object` | no | |

## Outputs: show

| Name | Type | Required | Description |
| - | - | - | - |
| `action` | `"show"` | yes | |
| `importId` | `string` | yes | |
| `name` | `string` | yes | |
| `yaml` | `string` | yes | |
| `proposals` | `object[]` | yes | |
| `unmapped` | `object[]` | yes | |
| `diff` | `object` | yes | |

## Outputs: apply

| Name | Type | Required | Description |
| - | - | - | - |
| `action` | `"apply"` | yes | |
| `importId` | `string` | yes | |
| `count` | `integer` | yes | |
| `applied` | `object[]` | yes | |

## A real call

Recorded by this site's `tools` run, step `object-import-draft`, with the published OODS Foundry 0.10.1.

Its input:

```
{
  "action": "draft",
  "source": {
    "path": "<workspace>/object-import/petstore.yaml"
  }
}
```

Its result:

```
{
  "action": "draft",
  "importId": "import-b122a677b9b8343ab1783872c1563f34a394f232b8776029d699271a64fcd07d",
  "directory": "~/.oods-foundry/imports/import-b122a677b9b8343ab1783872c1563f34a394f232b8776029d699271a64fcd07d",
  "contentHash": "sha256:380789f6757c66ca7a800f731767211ec663da702a3e851aef3980557bbef246",
  "counts": {
    "total": 48,
    "mapped": 25,
    "proposed": 0,
    "unmapped": 23,
    "fields": 5,
    "mappedFields": 5
  },
  "objectCount": 7,
  "objects": [
    "Error",
    "Operation27023d0e7d",
    "Operation4d740bf4c2",
    "Operation4deff75316",
    "Operation68547e2036",
    "Operationc343d75736",
    "Pet"
  ],
  "objectsTruncated": false,
  "shippedClashes": [],
  "diff": {
    "new": 7,
    "changed": 0,
    "unchanged": 0,
    "file": "~/.oods-foundry/imports/import-b122a677b9b8343ab1783872c1563f34a394f232b8776029d699271a64fcd07d/diff.json"
  },
  "proposalTraits": {},
  "proposalGrades": {
    "strong": 0,
    "medium": 0,
    "weak": 0
  },
  "cycleCount": 0,
  "files": {
    "hub": "hub.json",
    "report": "report.json",
    "order": "order.json",
    "objects": "objects/"
  }
}
```

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