# Mapping Config

## Format

File: `ingest/scenarios/<scenario>/<entity-name>/entity.json`

```json
{
  "name": "<EntityName>",
  "dataFile": "data.jsonl",
  "graphqlFile": "../../../mutations/create<EntityName>.graphql",
  "mapping": {
    "input": "$"
  }
}
```

## Path Resolution

Paths in `entity.json` are relative to the **entity directory** (the directory containing the `entity.json` file).

For `ingest/scenarios/baseline/customer/entity.json`:
- Entity directory = `ingest/scenarios/baseline/customer/`
- `dataFile: "data.jsonl"` → `ingest/scenarios/baseline/customer/data.jsonl`
- `graphqlFile: "../../../mutations/createCustomer.graphql"` → `ingest/mutations/createCustomer.graphql`

## Rules

- `mapping: { "input": "$" }` maps the entire JSONL row to the mutation's `$input` variable
- This works when JSONL field names match the GraphQL input type field names exactly
- If the JSONL uses different field names, use explicit field mapping:
  ```json
  {
    "mapping": {
      "input": {
        "customerName": "name",
        "customerEmail": "email"
      }
    }
  }
  ```
- The `name` field is required — gql-ingest uses it for dependency resolution and logging
- One `entity.json` per entity per scenario
- Directory name is freeform — the `name` field is what gql-ingest uses for dependency resolution
