Browse operation contracts · Static machine index · OpenAPI release reference · Build manifest

Nested record mapping with guarded patches

Construct nested destination records from explicit copy, literal and exact-string lookup rules. Return bounded provenance and optional root-test-guarded RFC 6902 patches. Object destinations only; no implicit coercion, expressions, array expansion, writes or source authenticity checks.

structured · Operation ID: records-map-transform

Choose this operation when

Outside this profile

Exact release references

Static JSON contract · Markdown reference · Fixed example response

Complete input schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "records": {
      "maxItems": 128,
      "type": "array",
      "items": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "$ref": "#/$defs/__schema0"
        }
      }
    },
    "rules": {
      "minItems": 1,
      "maxItems": 32,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "destination": {
            "type": "string",
            "maxLength": 1024
          },
          "source": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "copy"
                  },
                  "pointer": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "onMissing": {
                    "type": "string",
                    "enum": [
                      "error",
                      "omit",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "pointer",
                  "onMissing"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "literal"
                  },
                  "value": {
                    "$ref": "#/$defs/__schema0"
                  }
                },
                "required": [
                  "kind",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "lookup"
                  },
                  "pointer": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "pairs": {
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "value": {
                          "$ref": "#/$defs/__schema0"
                        }
                      },
                      "required": [
                        "key",
                        "value"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "onUnknown": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "error"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "default"
                          },
                          "value": {
                            "$ref": "#/$defs/__schema0"
                          }
                        },
                        "required": [
                          "kind",
                          "value"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "pointer",
                  "pairs",
                  "onUnknown"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "id",
          "destination",
          "source"
        ],
        "additionalProperties": false
      }
    },
    "mode": {
      "type": "string",
      "enum": [
        "records",
        "guarded-patches",
        "both"
      ]
    }
  },
  "required": [
    "records",
    "rules",
    "mode"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  }
}

Complete output-envelope schema

{
  "type": "object",
  "required": [
    "operation",
    "version",
    "result",
    "provenance"
  ],
  "properties": {
    "operation": {
      "const": "records-map-transform",
      "type": "string"
    },
    "version": {
      "const": "0.29.0",
      "type": "string"
    },
    "result": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "profile": {
          "type": "string",
          "const": "nested-record-map-v1"
        },
        "mode": {
          "type": "string",
          "enum": [
            "records",
            "guarded-patches",
            "both"
          ]
        },
        "rows": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "sourceIndex": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "record": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "$ref": "#/properties/result/$defs/__schema0"
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "provenance": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "ruleId": {
                      "type": "string"
                    },
                    "sourcePointer": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "destinationPointer": {
                      "type": "string"
                    },
                    "sourcePresent": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "disposition": {
                      "type": "string",
                      "enum": [
                        "copied",
                        "literal",
                        "lookup",
                        "default",
                        "omitted"
                      ]
                    }
                  },
                  "required": [
                    "ruleId",
                    "sourcePointer",
                    "destinationPointer",
                    "sourcePresent",
                    "disposition"
                  ],
                  "additionalProperties": false
                }
              },
              "patch": {
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "test"
                            },
                            "path": {
                              "type": "string",
                              "const": ""
                            },
                            "value": {
                              "$ref": "#/properties/result/$defs/__schema0"
                            }
                          },
                          "required": [
                            "op",
                            "path",
                            "value"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "add"
                            },
                            "path": {
                              "type": "string",
                              "maxLength": 1024
                            },
                            "value": {
                              "$ref": "#/properties/result/$defs/__schema0"
                            }
                          },
                          "required": [
                            "op",
                            "path",
                            "value"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "replace"
                            },
                            "path": {
                              "type": "string",
                              "maxLength": 1024
                            },
                            "value": {
                              "$ref": "#/properties/result/$defs/__schema0"
                            }
                          },
                          "required": [
                            "op",
                            "path",
                            "value"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "op": {
                              "type": "string",
                              "const": "remove"
                            },
                            "path": {
                              "type": "string",
                              "maxLength": 1024
                            }
                          },
                          "required": [
                            "op",
                            "path"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "sourceIndex",
              "record",
              "provenance",
              "patch"
            ],
            "additionalProperties": false
          }
        },
        "recordCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "operationCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "externalRequests": {
          "type": "number",
          "const": 0
        },
        "execution": {
          "type": "boolean",
          "const": false
        }
      },
      "required": [
        "profile",
        "mode",
        "rows",
        "recordCount",
        "operationCount",
        "externalRequests",
        "execution"
      ],
      "additionalProperties": false,
      "$defs": {
        "__schema0": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/properties/result/$defs/__schema0"
              }
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "$ref": "#/properties/result/$defs/__schema0"
              }
            }
          ]
        }
      }
    },
    "provenance": {
      "type": "object",
      "required": [
        "inputSha256",
        "outputSha256",
        "deterministic",
        "externalRequests"
      ],
      "properties": {
        "inputSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "outputSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "deterministic": {
          "const": true
        },
        "externalRequests": {
          "const": 0
        }
      }
    }
  },
  "additionalProperties": false
}

Fixed example

One accepted fixed example, not a custom-input trial. No operation runs when this static page is requested.

Example input

{
  "records": [
    {
      "id": "c7",
      "display": "Ada",
      "tier": "pro"
    }
  ],
  "rules": [
    {
      "id": "id",
      "destination": "/customer/id",
      "source": {
        "kind": "copy",
        "pointer": "/id",
        "onMissing": "error"
      }
    },
    {
      "id": "name",
      "destination": "/customer/name",
      "source": {
        "kind": "copy",
        "pointer": "/display",
        "onMissing": "error"
      }
    },
    {
      "id": "plan",
      "destination": "/plan",
      "source": {
        "kind": "lookup",
        "pointer": "/tier",
        "pairs": [
          {
            "key": "pro",
            "value": "paid"
          }
        ],
        "onUnknown": {
          "kind": "error"
        }
      }
    },
    {
      "id": "version",
      "destination": "/apiVersion",
      "source": {
        "kind": "literal",
        "value": 1
      }
    }
  ],
  "mode": "both"
}

Example response

{
  "operation": "records-map-transform",
  "version": "0.29.0",
  "result": {
    "profile": "nested-record-map-v1",
    "mode": "both",
    "rows": [
      {
        "sourceIndex": 0,
        "record": {
          "apiVersion": 1,
          "customer": {
            "id": "c7",
            "name": "Ada"
          },
          "plan": "paid"
        },
        "provenance": [
          {
            "ruleId": "id",
            "sourcePointer": "/id",
            "destinationPointer": "/customer/id",
            "sourcePresent": true,
            "disposition": "copied"
          },
          {
            "ruleId": "name",
            "sourcePointer": "/display",
            "destinationPointer": "/customer/name",
            "sourcePresent": true,
            "disposition": "copied"
          },
          {
            "ruleId": "plan",
            "sourcePointer": "/tier",
            "destinationPointer": "/plan",
            "sourcePresent": true,
            "disposition": "lookup"
          },
          {
            "ruleId": "version",
            "sourcePointer": null,
            "destinationPointer": "/apiVersion",
            "sourcePresent": null,
            "disposition": "literal"
          }
        ],
        "patch": [
          {
            "op": "test",
            "path": "",
            "value": {
              "display": "Ada",
              "id": "c7",
              "tier": "pro"
            }
          },
          {
            "op": "add",
            "path": "/apiVersion",
            "value": 1
          },
          {
            "op": "add",
            "path": "/customer",
            "value": {
              "id": "c7",
              "name": "Ada"
            }
          },
          {
            "op": "remove",
            "path": "/display"
          },
          {
            "op": "remove",
            "path": "/id"
          },
          {
            "op": "add",
            "path": "/plan",
            "value": "paid"
          },
          {
            "op": "remove",
            "path": "/tier"
          }
        ]
      }
    ],
    "recordCount": 1,
    "operationCount": 7,
    "externalRequests": 0,
    "execution": false
  },
  "provenance": {
    "inputSha256": "8a4f0c25859630ea88a6e0300b7add71a1a2bf111d562cb9d5293cc61cd85cff",
    "outputSha256": "6344421da2c94f9751785c5e99bf3febd7bc3fce3d06070bd5777e2b0d7076ee",
    "deterministic": true,
    "externalRequests": 0
  }
}

Bounds and precision

JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.

{
  "global": {
    "requestBytes": 131072,
    "responseBytes": 524288,
    "jsonDepth": 32,
    "jsonNodes": 20000,
    "requestsPerMinute": 60,
    "paidAttemptsPerMinute": 20,
    "idempotencyHours": 24
  },
  "operation": {
    "inputBytes": 100000,
    "outputBytes": 400000,
    "jsonNodes": 12000,
    "depth": 20,
    "records": 128,
    "rules": 32,
    "pointerDepth": 12,
    "pointerUnits": 1024,
    "lookupPairsPerRule": 64,
    "lookupPairsTotal": 512,
    "patchesPerRow": 100,
    "patchesTotal": 2000,
    "projectedDestinationBytes": 400000,
    "destinationJsonNodes": 12000,
    "patchConsumerNodeWork": 50000,
    "patchConsumerCharacterWork": 5000000,
    "patchConsumerContainerEntries": 1000,
    "patchConsumerJsonNodes": 20000,
    "patchConsumerJsonCharacters": 100000,
    "patchConsumerDepth": 32
  }
}

Complete schemas, descriptions and cross-field validation may impose additional limits.

Proposed price and protocol definitions

{
  "unit": "one successful operation call",
  "proposedNominalUsd": "0.005",
  "sixDecimalTokenBaseUnits": "5000",
  "subscription": false,
  "includesPayerWalletOrNetworkFees": false,
  "liveQuoteVerified": false,
  "condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
}

Protocol definitions: x402, mpp. MPP uses Tempo charge. Paid MCP execution is unsupported. All runtime readiness is not evaluated in this build.

API path templates, not endpoints on this documentation host

{
  "x402": "/v1/x402/records-map-transform",
  "mpp": "/v1/mpp/records-map-transform"
}

Required headers

{
  "Content-Type": "application/json",
  "Idempotency-Key": "random 16–128 character operation identifier"
}

Actual SDK challenge amount, asset, network, recipient and wallet costs must pass independent authorization. Preserve identical key, body, protocol and credential on retries; on PAYMENT_UNCERTAIN stop and reconcile.

Execution profile and provider conditions

{
  "deterministic": true,
  "externalRequests": 0,
  "maxExternalRequests": 0,
  "resultSnapshotPersisted": false,
  "fixedExampleIsIllustrativeSnapshot": false,
  "requiresPayment": true,
  "supportsMcpExecution": false
}

Deterministic supplied-input operation with no external requests or stored request/result bodies. Payment infrastructure retains payment metadata and hashes.

Failure handling

Declared requirements

Before any paid call, refresh the live operation contract and POST the complete bounded budgeted plan to the separate API's /preflight. Unknown requirements block selection; compatible preflight is not permission to spend.

Related contracts