Zum Inhalt
HALOWERK

Agentenwerk

twin diff

Takes two state documents — target (what the twin should look like) and observed (what was measured) — and returns a leaf-by-leaf comparison. Every leaf path carries one of five states: in_tolerance, out_of_tolerance, missing_in_observed, unexpected_in_observed or type_mismatch.

POST https://agent.halowerk.com/v1/twin-diff

Eingaben

Felder des veröffentlichten Eingabeschemas
FeldTypPflichtBeschreibung
targetobjectJaThe desired state document (the twin).
observedobjectJaThe observed state document (the measurement).
tolerancesarrayNeinPer-path tolerances. Give tolerance_abs or tolerance_ratio, not both.
default_tolerance_rationumberNeinRelative tolerance for numeric paths without their own entry. 0 means exact equality.
ignore_fieldsarrayNeinPaths to leave out of the comparison. A trailing /* ignores everything below that prefix.
case_insensitive_stringsbooleanNeinCompare string leaves without regard to case.
max_fieldsintegerNeinReject the request if the two documents together hold more leaf paths than this.
Vollständiges Eingabeschema anzeigen
{
  "type": "object",
  "required": [
    "target",
    "observed"
  ],
  "additionalProperties": false,
  "properties": {
    "target": {
      "type": "object",
      "description": "The desired state document (the twin)."
    },
    "observed": {
      "type": "object",
      "description": "The observed state document (the measurement)."
    },
    "tolerances": {
      "type": "array",
      "maxItems": 200,
      "description": "Per-path tolerances. Give tolerance_abs or tolerance_ratio, not both.",
      "items": {
        "type": "object",
        "required": [
          "field"
        ],
        "additionalProperties": false,
        "properties": {
          "field": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400,
            "description": "Leaf path as it appears in the result, e.g. /pump/pressure_bar. A trailing /* applies the entry to every leaf below that prefix."
          },
          "unit": {
            "type": "string",
            "maxLength": 32,
            "description": "Unit of this field, echoed into the result. Declared by you, never inferred."
          },
          "tolerance_abs": {
            "type": "number",
            "minimum": 0,
            "description": "Absolute tolerance in the unit of this field."
          },
          "tolerance_ratio": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Relative tolerance as a ratio of the larger of the two values."
          }
        }
      }
    },
    "default_tolerance_ratio": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0,
      "description": "Relative tolerance for numeric paths without their own entry. 0 means exact equality."
    },
    "ignore_fields": {
      "type": "array",
      "maxItems": 200,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 400
      },
      "description": "Paths to leave out of the comparison. A trailing /* ignores everything below that prefix."
    },
    "case_insensitive_strings": {
      "type": "boolean",
      "default": false,
      "description": "Compare string leaves without regard to case."
    },
    "max_fields": {
      "type": "integer",
      "minimum": 1,
      "maximum": 2000,
      "default": 2000,
      "description": "Reject the request if the two documents together hold more leaf paths than this."
    }
  }
}

Originalschema öffnen

Veröffentlichtes Eingabebeispiel

{
  "target": {
    "pump": {
      "pressure_bar": 4,
      "running": true
    },
    "firmware": "2.4.1",
    "site": {
      "radius_km": 12
    }
  },
  "observed": {
    "pump": {
      "pressure_bar": 4.15,
      "running": true
    },
    "firmware": "2.3.9",
    "site": {
      "radius_km": 12.4
    }
  },
  "tolerances": [
    {
      "field": "/pump/pressure_bar",
      "unit": "bar",
      "tolerance_abs": 0.2
    },
    {
      "field": "/site/radius_km",
      "unit": "km",
      "tolerance_ratio": 0.01
    }
  ],
  "default_tolerance_ratio": 0
}

Ergebnis & Dokumentation

Veröffentlichtes Ergebnisschema anzeigen
{
  "$ref": "https://agent.halowerk.com/v1/twin-diff/schema#/outputSchema"
}

Veröffentlichtes Ergebnisbeispiel öffnen

Maschinenlesbare Dokumentation dieses Hubs

Quelle dieser Seite: der veröffentlichte HALOWERK-Katalog. Stand: 2026-11-01, 15:19 UTC.

Weitere Endpunkte dieses Hubs

Alle Endpunkte dieses Hubs →