commit b025df0653f17364b4b7b1245f91779c769746f1
parent f3b89e9b8ae1e6fa0188109319b684df3386acd4
Author: triesap <tyson@radroots.org>
Date: Mon, 21 Sep 2026 03:34:03 +0000
spec: bind additive operation envelopes
Diffstat:
17 files changed, 2502 insertions(+), 1 deletion(-)
diff --git a/schemas/hyf_v1_jev/buyer_request_interpret.request.schema.json b/schemas/hyf_v1_jev/buyer_request_interpret.request.schema.json
@@ -0,0 +1,172 @@
+{
+ "$comment": "hyf_v1_jev additive wire envelope; strict unknown-field rejection",
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "integer",
+ "const": 1
+ },
+ "request_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "trace_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "capability": {
+ "type": "string",
+ "const": "buyer_request.interpret"
+ },
+ "context": {
+ "type": "object",
+ "properties": {
+ "consumer": {
+ "type": "string"
+ },
+ "execution_mode_preference": {
+ "type": "string",
+ "enum": [
+ "deterministic",
+ "assisted"
+ ]
+ },
+ "deadline_ms": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "evaluation_time": {
+ "type": "string"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "versions": {
+ "type": "object",
+ "properties": {
+ "schema": {
+ "type": "string"
+ },
+ "taxonomy": {
+ "type": "string"
+ },
+ "normalization": {
+ "type": "string"
+ },
+ "review_policy": {
+ "type": "string"
+ },
+ "ranking_policy": {
+ "type": "string"
+ },
+ "question_bundle": {
+ "type": "string"
+ },
+ "model": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "model",
+ "normalization",
+ "question_bundle",
+ "ranking_policy",
+ "review_policy",
+ "schema",
+ "taxonomy"
+ ],
+ "additionalProperties": false
+ },
+ "return_provenance": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "evaluation_time",
+ "versions"
+ ],
+ "additionalProperties": false
+ },
+ "input": {
+ "type": "object",
+ "properties": {
+ "source": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "text": {
+ "type": "string"
+ },
+ "source_time": {
+ "type": "string"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "actor_id": {
+ "type": "string"
+ },
+ "farm_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "source_id",
+ "revision",
+ "text",
+ "source_time",
+ "actor_id",
+ "farm_id"
+ ],
+ "additionalProperties": false
+ },
+ "clarification": {
+ "type": "object",
+ "properties": {
+ "target_field": {
+ "type": "string"
+ },
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "text": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "revision",
+ "source_id",
+ "target_field",
+ "text"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "source"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "version",
+ "request_id",
+ "capability",
+ "input"
+ ],
+ "additionalProperties": false
+}
diff --git a/schemas/hyf_v1_jev/buyer_request_interpret.response.schema.json b/schemas/hyf_v1_jev/buyer_request_interpret.response.schema.json
@@ -0,0 +1,316 @@
+{
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "integer",
+ "const": 1
+ },
+ "request_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "trace_id": {
+ "type": "string"
+ },
+ "ok": {
+ "type": "boolean"
+ },
+ "output": {
+ "type": "object",
+ "properties": {
+ "demand_lines": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "line_id": {
+ "type": "string"
+ },
+ "product": {
+ "type": "object",
+ "properties": {
+ "phrase": {
+ "type": "string"
+ },
+ "catalogue_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "resolution": {
+ "type": "string",
+ "enum": [
+ "resolved",
+ "unresolved"
+ ]
+ }
+ },
+ "required": [
+ "catalogue_id",
+ "phrase",
+ "resolution"
+ ],
+ "additionalProperties": false
+ },
+ "quantity": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "string",
+ "enum": [
+ "known",
+ "unknown"
+ ]
+ },
+ "value": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "unit": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "qualifier": {
+ "type": "string",
+ "enum": [
+ "exact",
+ "approximate"
+ ]
+ }
+ },
+ "required": [
+ "state",
+ "qualifier"
+ ],
+ "additionalProperties": false
+ },
+ "conditions": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "enum": [
+ "fulfillment",
+ "window",
+ "grade",
+ "price",
+ "attribute",
+ "substitution"
+ ]
+ },
+ "strength": {
+ "type": "string",
+ "enum": [
+ "mandatory",
+ "preferred",
+ "excluded",
+ "permitted"
+ ]
+ },
+ "value": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "evidence": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "start": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "end": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "method": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "end",
+ "method",
+ "revision",
+ "source_id",
+ "start"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "kind",
+ "strength",
+ "evidence"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "evidence": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "start": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "end": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "method": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "end",
+ "method",
+ "revision",
+ "source_id",
+ "start"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "review_required": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "line_id",
+ "product",
+ "quantity",
+ "conditions",
+ "evidence",
+ "review_required"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "review": {
+ "type": "object",
+ "properties": {
+ "required": {
+ "type": "boolean"
+ },
+ "clarifications": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "field": {
+ "type": "string"
+ },
+ "reason": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "field",
+ "reason"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "clarifications",
+ "required"
+ ],
+ "additionalProperties": false
+ },
+ "execution": {
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "complete",
+ "degraded",
+ "failed"
+ ]
+ },
+ "provider_calls": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "model": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "question_bundle": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "model",
+ "provider_calls",
+ "question_bundle",
+ "status"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "demand_lines",
+ "review",
+ "execution"
+ ],
+ "additionalProperties": false
+ },
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "code",
+ "message"
+ ],
+ "additionalProperties": false
+ },
+ "meta": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "required": [
+ "version",
+ "request_id",
+ "ok"
+ ],
+ "additionalProperties": false
+}
diff --git a/schemas/hyf_v1_jev/buyer_request_match.request.schema.json b/schemas/hyf_v1_jev/buyer_request_match.request.schema.json
@@ -0,0 +1,548 @@
+{
+ "$comment": "hyf_v1_jev additive wire envelope; strict unknown-field rejection",
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "integer",
+ "const": 1
+ },
+ "request_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "trace_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "capability": {
+ "type": "string",
+ "const": "buyer_request.match"
+ },
+ "context": {
+ "type": "object",
+ "properties": {
+ "consumer": {
+ "type": "string"
+ },
+ "execution_mode_preference": {
+ "type": "string",
+ "enum": [
+ "deterministic",
+ "assisted"
+ ]
+ },
+ "deadline_ms": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "evaluation_time": {
+ "type": "string"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "versions": {
+ "type": "object",
+ "properties": {
+ "schema": {
+ "type": "string"
+ },
+ "taxonomy": {
+ "type": "string"
+ },
+ "normalization": {
+ "type": "string"
+ },
+ "review_policy": {
+ "type": "string"
+ },
+ "ranking_policy": {
+ "type": "string"
+ },
+ "question_bundle": {
+ "type": "string"
+ },
+ "model": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "model",
+ "normalization",
+ "question_bundle",
+ "ranking_policy",
+ "review_policy",
+ "schema",
+ "taxonomy"
+ ],
+ "additionalProperties": false
+ },
+ "return_provenance": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "evaluation_time",
+ "versions"
+ ],
+ "additionalProperties": false
+ },
+ "input": {
+ "type": "object",
+ "properties": {
+ "need": {
+ "type": "object",
+ "properties": {
+ "need_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "demand_lines": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "line_id": {
+ "type": "string"
+ },
+ "product": {
+ "type": "object",
+ "properties": {
+ "phrase": {
+ "type": "string"
+ },
+ "catalogue_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "resolution": {
+ "type": "string",
+ "enum": [
+ "resolved",
+ "unresolved"
+ ]
+ }
+ },
+ "required": [
+ "catalogue_id",
+ "phrase",
+ "resolution"
+ ],
+ "additionalProperties": false
+ },
+ "quantity": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "string",
+ "enum": [
+ "known",
+ "unknown"
+ ]
+ },
+ "value": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "unit": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "qualifier": {
+ "type": "string",
+ "enum": [
+ "exact",
+ "approximate"
+ ]
+ }
+ },
+ "required": [
+ "state",
+ "qualifier"
+ ],
+ "additionalProperties": false
+ },
+ "conditions": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "enum": [
+ "fulfillment",
+ "window",
+ "grade",
+ "price",
+ "attribute",
+ "substitution"
+ ]
+ },
+ "strength": {
+ "type": "string",
+ "enum": [
+ "mandatory",
+ "preferred",
+ "excluded",
+ "permitted"
+ ]
+ },
+ "value": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "evidence": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "start": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "end": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "method": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "end",
+ "method",
+ "revision",
+ "source_id",
+ "start"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "kind",
+ "strength",
+ "evidence"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "evidence": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "start": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "end": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "method": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "end",
+ "method",
+ "revision",
+ "source_id",
+ "start"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "review_required": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "line_id",
+ "product",
+ "quantity",
+ "conditions",
+ "evidence",
+ "review_required"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "partial_fulfillment": {
+ "type": "string",
+ "enum": [
+ "allowed",
+ "disallowed",
+ "unstated"
+ ]
+ }
+ },
+ "required": [
+ "need_id",
+ "revision",
+ "demand_lines",
+ "partial_fulfillment"
+ ],
+ "additionalProperties": false
+ },
+ "snapshots": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "lot_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "supplier_id": {
+ "type": "string"
+ },
+ "product": {
+ "type": "object",
+ "properties": {
+ "phrase": {
+ "type": "string"
+ },
+ "catalogue_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "resolution": {
+ "type": "string",
+ "enum": [
+ "resolved",
+ "unresolved"
+ ]
+ }
+ },
+ "required": [
+ "catalogue_id",
+ "phrase",
+ "resolution"
+ ],
+ "additionalProperties": false
+ },
+ "unreserved_quantity": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "string",
+ "enum": [
+ "known",
+ "unknown"
+ ]
+ },
+ "value": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "unit": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "qualifier": {
+ "type": "string",
+ "enum": [
+ "exact",
+ "approximate"
+ ]
+ }
+ },
+ "required": [
+ "state",
+ "qualifier"
+ ],
+ "additionalProperties": false
+ },
+ "attributes": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "verified": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "name",
+ "verified"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "fulfillment": {
+ "type": "object",
+ "properties": {
+ "method": {
+ "type": "string",
+ "enum": [
+ "pickup",
+ "delivery",
+ "unspecified"
+ ]
+ },
+ "area": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "window": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "area",
+ "method",
+ "window"
+ ],
+ "additionalProperties": false
+ },
+ "price": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "string",
+ "enum": [
+ "known",
+ "unknown"
+ ]
+ },
+ "amount": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "currency": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "basis": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "amount",
+ "basis",
+ "currency",
+ "state"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "lot_id",
+ "revision",
+ "supplier_id",
+ "product",
+ "unreserved_quantity"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "coverage": {
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "string",
+ "enum": [
+ "supplied_only"
+ ]
+ },
+ "truncated": {
+ "type": "boolean"
+ },
+ "evaluated": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "excluded": {
+ "type": "integer",
+ "minimum": 0
+ }
+ },
+ "required": [
+ "scope",
+ "truncated"
+ ],
+ "additionalProperties": false
+ },
+ "policy": {
+ "type": "object",
+ "properties": {
+ "ranking_policy": {
+ "type": "string"
+ },
+ "review_policy": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "ranking_policy",
+ "review_policy"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "need",
+ "snapshots",
+ "coverage"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "version",
+ "request_id",
+ "capability",
+ "input"
+ ],
+ "additionalProperties": false
+}
diff --git a/schemas/hyf_v1_jev/buyer_request_match.response.schema.json b/schemas/hyf_v1_jev/buyer_request_match.response.schema.json
@@ -0,0 +1,351 @@
+{
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "integer",
+ "const": 1
+ },
+ "request_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "trace_id": {
+ "type": "string"
+ },
+ "ok": {
+ "type": "boolean"
+ },
+ "output": {
+ "type": "object",
+ "properties": {
+ "assessments": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "candidate_id": {
+ "type": "string"
+ },
+ "eligibility": {
+ "type": "string",
+ "enum": [
+ "eligible",
+ "conditional",
+ "ineligible"
+ ]
+ },
+ "checks": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string"
+ },
+ "result": {
+ "type": "string",
+ "enum": [
+ "pass",
+ "fail",
+ "unknown"
+ ]
+ },
+ "reason": {
+ "type": "string"
+ },
+ "evidence": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "start": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "end": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "method": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "end",
+ "method",
+ "revision",
+ "source_id",
+ "start"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "kind",
+ "result",
+ "reason"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "candidate_id",
+ "checks",
+ "eligibility"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "plans": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "plan_id": {
+ "type": "string"
+ },
+ "supplier_id": {
+ "type": "string"
+ },
+ "allocations": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "lot_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "line_id": {
+ "type": "string"
+ },
+ "quantity": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "string",
+ "enum": [
+ "known",
+ "unknown"
+ ]
+ },
+ "value": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "unit": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "qualifier": {
+ "type": "string",
+ "enum": [
+ "exact",
+ "approximate"
+ ]
+ }
+ },
+ "required": [
+ "state",
+ "qualifier"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "lot_id",
+ "revision",
+ "line_id",
+ "quantity"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "coverage": {
+ "type": "object",
+ "properties": {
+ "lines_covered": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "uncovered": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "partial": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "lines_covered",
+ "partial",
+ "uncovered"
+ ],
+ "additionalProperties": false
+ },
+ "unresolved": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string"
+ },
+ "reason": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "kind",
+ "reason"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "preference": {
+ "type": "object",
+ "properties": {
+ "policy": {
+ "type": "string"
+ },
+ "score": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "policy",
+ "score"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "plan_id",
+ "supplier_id",
+ "allocations",
+ "coverage"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "limitations": {
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "string",
+ "enum": [
+ "supplied_only"
+ ]
+ },
+ "truncated": {
+ "type": "boolean"
+ },
+ "supported_mode": {
+ "type": "string"
+ },
+ "unsupported": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "scope",
+ "supported_mode",
+ "truncated",
+ "unsupported"
+ ],
+ "additionalProperties": false
+ },
+ "execution": {
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "complete",
+ "degraded",
+ "failed"
+ ]
+ },
+ "provider_calls": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "model": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "question_bundle": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "model",
+ "provider_calls",
+ "question_bundle",
+ "status"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "assessments",
+ "plans",
+ "limitations",
+ "execution"
+ ],
+ "additionalProperties": false
+ },
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "code",
+ "message"
+ ],
+ "additionalProperties": false
+ },
+ "meta": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "required": [
+ "version",
+ "request_id",
+ "ok"
+ ],
+ "additionalProperties": false
+}
diff --git a/schemas/hyf_v1_jev/examples/invalid/buyer_request_interpret.response.wrong_type.json b/schemas/hyf_v1_jev/examples/invalid/buyer_request_interpret.response.wrong_type.json
@@ -0,0 +1,23 @@
+{
+ "version": 1,
+ "request_id": "buyer_request.interpret-ex-1",
+ "trace_id": "trace-buyer_request.interpret-ex-1",
+ "ok": true,
+ "output": {
+ "demand_lines": "not-an-array",
+ "review": {
+ "required": false,
+ "clarifications": []
+ },
+ "execution": {
+ "status": "complete",
+ "provider_calls": 0,
+ "model": null,
+ "question_bundle": "qb1"
+ }
+ },
+ "meta": {
+ "execution_mode": "deterministic",
+ "backend": "heuristic"
+ }
+}
diff --git a/schemas/hyf_v1_jev/examples/invalid/buyer_request_match.request.bad_eligibility.json b/schemas/hyf_v1_jev/examples/invalid/buyer_request_match.request.bad_eligibility.json
@@ -0,0 +1,71 @@
+{
+ "version": 1,
+ "request_id": "buyer_request.match-ex-1",
+ "trace_id": "trace-buyer_request.match-ex-1",
+ "capability": "buyer_request.match",
+ "context": {
+ "execution_mode_preference": "deterministic",
+ "evaluation_time": "2026-09-21T10:00:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "versions": {
+ "schema": "v1",
+ "taxonomy": "test-only-produce-1",
+ "normalization": "n1",
+ "review_policy": "rp1",
+ "ranking_policy": "rk1",
+ "question_bundle": "qb1",
+ "model": "jev-1.13.0"
+ }
+ },
+ "input": {
+ "need": {
+ "need_id": "n1",
+ "revision": "n1",
+ "partial_fulfillment": "disallowed",
+ "demand_lines": [
+ {
+ "line_id": "l1",
+ "product": {
+ "phrase": "tomatoes",
+ "catalogue_id": "tomato",
+ "resolution": "resolved"
+ },
+ "quantity": {
+ "state": "known",
+ "value": "25",
+ "unit": "kg",
+ "qualifier": "exact"
+ },
+ "conditions": [],
+ "evidence": [],
+ "review_required": false
+ }
+ ]
+ },
+ "snapshots": [
+ {
+ "lot_id": "lot-1",
+ "revision": "l1",
+ "supplier_id": "farm-1",
+ "product": {
+ "phrase": "Roma tomatoes",
+ "catalogue_id": "tomato.roma",
+ "resolution": "resolved"
+ },
+ "unreserved_quantity": {
+ "state": "known",
+ "value": "50",
+ "unit": "kg",
+ "qualifier": "exact"
+ }
+ }
+ ],
+ "coverage": {
+ "scope": "global_market",
+ "truncated": false,
+ "evaluated": 1,
+ "excluded": 0
+ }
+ }
+}
diff --git a/schemas/hyf_v1_jev/examples/invalid/farm_update_interpret.request.unknown_field.json b/schemas/hyf_v1_jev/examples/invalid/farm_update_interpret.request.unknown_field.json
@@ -0,0 +1,34 @@
+{
+ "version": 1,
+ "request_id": "farm_update.interpret-ex-1",
+ "trace_id": "trace-farm_update.interpret-ex-1",
+ "capability": "farm_update.interpret",
+ "context": {
+ "execution_mode_preference": "deterministic",
+ "evaluation_time": "2026-09-21T10:00:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "versions": {
+ "schema": "v1",
+ "taxonomy": "test-only-produce-1",
+ "normalization": "n1",
+ "review_policy": "rp1",
+ "ranking_policy": "rk1",
+ "question_bundle": "qb1",
+ "model": "jev-1.13.0"
+ }
+ },
+ "input": {
+ "source": {
+ "source_id": "farm-source-1",
+ "revision": "r1",
+ "text": "Got about 80 lb of Roma tomatoes, seconds for sauce.",
+ "source_time": "2026-09-21T09:00:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "actor_id": "farm-1",
+ "farm_id": "farm-1"
+ }
+ },
+ "planner": "strict"
+}
diff --git a/schemas/hyf_v1_jev/examples/valid/buyer_request_interpret.request.json b/schemas/hyf_v1_jev/examples/valid/buyer_request_interpret.request.json
@@ -0,0 +1,33 @@
+{
+ "version": 1,
+ "request_id": "buyer_request.interpret-ex-1",
+ "trace_id": "trace-buyer_request.interpret-ex-1",
+ "capability": "buyer_request.interpret",
+ "context": {
+ "execution_mode_preference": "deterministic",
+ "evaluation_time": "2026-09-21T10:00:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "versions": {
+ "schema": "v1",
+ "taxonomy": "test-only-produce-1",
+ "normalization": "n1",
+ "review_policy": "rp1",
+ "ranking_policy": "rk1",
+ "question_bundle": "qb1",
+ "model": "jev-1.13.0"
+ }
+ },
+ "input": {
+ "source": {
+ "source_id": "buyer-source-1",
+ "revision": "r1",
+ "text": "Need 25 kg of tomatoes for sauce, delivered Friday. Seconds are fine.",
+ "source_time": "2026-09-21T09:05:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "actor_id": "buyer-1",
+ "farm_id": "buyer-1"
+ }
+ }
+}
diff --git a/schemas/hyf_v1_jev/examples/valid/buyer_request_interpret.response.json b/schemas/hyf_v1_jev/examples/valid/buyer_request_interpret.response.json
@@ -0,0 +1,54 @@
+{
+ "version": 1,
+ "request_id": "buyer_request.interpret-ex-1",
+ "trace_id": "trace-buyer_request.interpret-ex-1",
+ "ok": true,
+ "output": {
+ "demand_lines": [
+ {
+ "line_id": "l1",
+ "product": {
+ "phrase": "tomatoes",
+ "catalogue_id": "tomato",
+ "resolution": "resolved"
+ },
+ "quantity": {
+ "state": "known",
+ "value": "25",
+ "unit": "kg",
+ "qualifier": "exact"
+ },
+ "conditions": [
+ {
+ "kind": "fulfillment",
+ "strength": "mandatory",
+ "value": "delivery",
+ "evidence": []
+ },
+ {
+ "kind": "grade",
+ "strength": "permitted",
+ "value": "seconds",
+ "evidence": []
+ }
+ ],
+ "evidence": [],
+ "review_required": false
+ }
+ ],
+ "review": {
+ "required": false,
+ "clarifications": []
+ },
+ "execution": {
+ "status": "complete",
+ "provider_calls": 0,
+ "model": null,
+ "question_bundle": "qb1"
+ }
+ },
+ "meta": {
+ "execution_mode": "deterministic",
+ "backend": "heuristic"
+ }
+}
diff --git a/schemas/hyf_v1_jev/examples/valid/buyer_request_match.request.json b/schemas/hyf_v1_jev/examples/valid/buyer_request_match.request.json
@@ -0,0 +1,71 @@
+{
+ "version": 1,
+ "request_id": "buyer_request.match-ex-1",
+ "trace_id": "trace-buyer_request.match-ex-1",
+ "capability": "buyer_request.match",
+ "context": {
+ "execution_mode_preference": "deterministic",
+ "evaluation_time": "2026-09-21T10:00:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "versions": {
+ "schema": "v1",
+ "taxonomy": "test-only-produce-1",
+ "normalization": "n1",
+ "review_policy": "rp1",
+ "ranking_policy": "rk1",
+ "question_bundle": "qb1",
+ "model": "jev-1.13.0"
+ }
+ },
+ "input": {
+ "need": {
+ "need_id": "n1",
+ "revision": "n1",
+ "partial_fulfillment": "disallowed",
+ "demand_lines": [
+ {
+ "line_id": "l1",
+ "product": {
+ "phrase": "tomatoes",
+ "catalogue_id": "tomato",
+ "resolution": "resolved"
+ },
+ "quantity": {
+ "state": "known",
+ "value": "25",
+ "unit": "kg",
+ "qualifier": "exact"
+ },
+ "conditions": [],
+ "evidence": [],
+ "review_required": false
+ }
+ ]
+ },
+ "snapshots": [
+ {
+ "lot_id": "lot-1",
+ "revision": "l1",
+ "supplier_id": "farm-1",
+ "product": {
+ "phrase": "Roma tomatoes",
+ "catalogue_id": "tomato.roma",
+ "resolution": "resolved"
+ },
+ "unreserved_quantity": {
+ "state": "known",
+ "value": "50",
+ "unit": "kg",
+ "qualifier": "exact"
+ }
+ }
+ ],
+ "coverage": {
+ "scope": "supplied_only",
+ "truncated": false,
+ "evaluated": 1,
+ "excluded": 0
+ }
+ }
+}
diff --git a/schemas/hyf_v1_jev/examples/valid/buyer_request_match.response.json b/schemas/hyf_v1_jev/examples/valid/buyer_request_match.response.json
@@ -0,0 +1,71 @@
+{
+ "version": 1,
+ "request_id": "buyer_request.match-ex-1",
+ "trace_id": "trace-buyer_request.match-ex-1",
+ "ok": true,
+ "output": {
+ "assessments": [
+ {
+ "candidate_id": "lot-1",
+ "eligibility": "eligible",
+ "checks": [
+ {
+ "kind": "product",
+ "result": "pass",
+ "reason": "catalogue match",
+ "evidence": []
+ }
+ ]
+ }
+ ],
+ "plans": [
+ {
+ "plan_id": "p1",
+ "supplier_id": "farm-1",
+ "allocations": [
+ {
+ "lot_id": "lot-1",
+ "revision": "l1",
+ "line_id": "l1",
+ "quantity": {
+ "state": "known",
+ "value": "25",
+ "unit": "kg",
+ "qualifier": "exact"
+ }
+ }
+ ],
+ "coverage": {
+ "lines_covered": [
+ "l1"
+ ],
+ "uncovered": [],
+ "partial": false
+ },
+ "unresolved": [],
+ "preference": {
+ "policy": "rk1",
+ "score": 0
+ }
+ }
+ ],
+ "limitations": {
+ "scope": "supplied_only",
+ "truncated": false,
+ "supported_mode": "single_supplier_compatible_lots",
+ "unsupported": [
+ "multi_supplier"
+ ]
+ },
+ "execution": {
+ "status": "complete",
+ "provider_calls": 0,
+ "model": null,
+ "question_bundle": "qb1"
+ }
+ },
+ "meta": {
+ "execution_mode": "deterministic",
+ "backend": "heuristic"
+ }
+}
diff --git a/schemas/hyf_v1_jev/examples/valid/farm_update_interpret.request.json b/schemas/hyf_v1_jev/examples/valid/farm_update_interpret.request.json
@@ -0,0 +1,33 @@
+{
+ "version": 1,
+ "request_id": "farm_update.interpret-ex-1",
+ "trace_id": "trace-farm_update.interpret-ex-1",
+ "capability": "farm_update.interpret",
+ "context": {
+ "execution_mode_preference": "deterministic",
+ "evaluation_time": "2026-09-21T10:00:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "versions": {
+ "schema": "v1",
+ "taxonomy": "test-only-produce-1",
+ "normalization": "n1",
+ "review_policy": "rp1",
+ "ranking_policy": "rk1",
+ "question_bundle": "qb1",
+ "model": "jev-1.13.0"
+ }
+ },
+ "input": {
+ "source": {
+ "source_id": "farm-source-1",
+ "revision": "r1",
+ "text": "Got about 80 lb of Roma tomatoes, seconds for sauce.",
+ "source_time": "2026-09-21T09:00:00-07:00",
+ "timezone": "America/Vancouver",
+ "locale": "en-CA",
+ "actor_id": "farm-1",
+ "farm_id": "farm-1"
+ }
+ }
+}
diff --git a/schemas/hyf_v1_jev/examples/valid/farm_update_interpret.response.json b/schemas/hyf_v1_jev/examples/valid/farm_update_interpret.response.json
@@ -0,0 +1,55 @@
+{
+ "version": 1,
+ "request_id": "farm_update.interpret-ex-1",
+ "trace_id": "trace-farm_update.interpret-ex-1",
+ "ok": true,
+ "output": {
+ "claims": [
+ {
+ "claim_id": "c1",
+ "product": {
+ "phrase": "Roma tomatoes",
+ "catalogue_id": "tomato.roma",
+ "resolution": "resolved"
+ },
+ "status": "offered",
+ "quantity": {
+ "state": "known",
+ "value": "80",
+ "unit": "lb",
+ "qualifier": "approximate"
+ },
+ "evidence": [
+ {
+ "source_id": "farm-source-1",
+ "revision": "r1",
+ "start": 4,
+ "end": 14,
+ "method": "span"
+ }
+ ],
+ "review_required": true
+ }
+ ],
+ "proposed_changes": [],
+ "review": {
+ "required": true,
+ "clarifications": [
+ {
+ "field": "quantity.unreserved",
+ "reason": "reported total is not verified unreserved stock"
+ }
+ ]
+ },
+ "execution": {
+ "status": "complete",
+ "provider_calls": 0,
+ "model": null,
+ "question_bundle": "qb1"
+ }
+ },
+ "meta": {
+ "execution_mode": "deterministic",
+ "backend": "heuristic"
+ }
+}
diff --git a/schemas/hyf_v1_jev/farm_update_interpret.request.schema.json b/schemas/hyf_v1_jev/farm_update_interpret.request.schema.json
@@ -0,0 +1,195 @@
+{
+ "$comment": "hyf_v1_jev additive wire envelope; strict unknown-field rejection",
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "integer",
+ "const": 1
+ },
+ "request_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "trace_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "capability": {
+ "type": "string",
+ "const": "farm_update.interpret"
+ },
+ "context": {
+ "type": "object",
+ "properties": {
+ "consumer": {
+ "type": "string"
+ },
+ "execution_mode_preference": {
+ "type": "string",
+ "enum": [
+ "deterministic",
+ "assisted"
+ ]
+ },
+ "deadline_ms": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "evaluation_time": {
+ "type": "string"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "versions": {
+ "type": "object",
+ "properties": {
+ "schema": {
+ "type": "string"
+ },
+ "taxonomy": {
+ "type": "string"
+ },
+ "normalization": {
+ "type": "string"
+ },
+ "review_policy": {
+ "type": "string"
+ },
+ "ranking_policy": {
+ "type": "string"
+ },
+ "question_bundle": {
+ "type": "string"
+ },
+ "model": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "model",
+ "normalization",
+ "question_bundle",
+ "ranking_policy",
+ "review_policy",
+ "schema",
+ "taxonomy"
+ ],
+ "additionalProperties": false
+ },
+ "return_provenance": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "evaluation_time",
+ "versions"
+ ],
+ "additionalProperties": false
+ },
+ "input": {
+ "type": "object",
+ "properties": {
+ "source": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "text": {
+ "type": "string"
+ },
+ "source_time": {
+ "type": "string"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "actor_id": {
+ "type": "string"
+ },
+ "farm_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "source_id",
+ "revision",
+ "text",
+ "source_time",
+ "actor_id",
+ "farm_id"
+ ],
+ "additionalProperties": false
+ },
+ "prior_records": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "record_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "role": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "record_id",
+ "revision",
+ "role"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "clarification": {
+ "type": "object",
+ "properties": {
+ "target_field": {
+ "type": "string"
+ },
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "text": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "revision",
+ "source_id",
+ "target_field",
+ "text"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "source"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "version",
+ "request_id",
+ "capability",
+ "input"
+ ],
+ "additionalProperties": false
+}
diff --git a/schemas/hyf_v1_jev/farm_update_interpret.response.schema.json b/schemas/hyf_v1_jev/farm_update_interpret.response.schema.json
@@ -0,0 +1,341 @@
+{
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "integer",
+ "const": 1
+ },
+ "request_id": {
+ "type": "string",
+ "minLength": 1
+ },
+ "trace_id": {
+ "type": "string"
+ },
+ "ok": {
+ "type": "boolean"
+ },
+ "output": {
+ "type": "object",
+ "properties": {
+ "claims": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "claim_id": {
+ "type": "string"
+ },
+ "product": {
+ "type": "object",
+ "properties": {
+ "phrase": {
+ "type": "string"
+ },
+ "catalogue_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "resolution": {
+ "type": "string",
+ "enum": [
+ "resolved",
+ "unresolved"
+ ]
+ }
+ },
+ "required": [
+ "catalogue_id",
+ "phrase",
+ "resolution"
+ ],
+ "additionalProperties": false
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "offered",
+ "forecast",
+ "unavailable",
+ "correction",
+ "unclear"
+ ]
+ },
+ "quantity": {
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "string",
+ "enum": [
+ "known",
+ "unknown"
+ ]
+ },
+ "value": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "unit": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "qualifier": {
+ "type": "string",
+ "enum": [
+ "exact",
+ "approximate"
+ ]
+ }
+ },
+ "required": [
+ "state",
+ "qualifier"
+ ],
+ "additionalProperties": false
+ },
+ "evidence": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "start": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "end": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "method": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "end",
+ "method",
+ "revision",
+ "source_id",
+ "start"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "review_required": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "claim_id",
+ "product",
+ "status",
+ "evidence",
+ "review_required"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "proposed_changes": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "target": {
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "enum": [
+ "listing",
+ "product",
+ "farm"
+ ]
+ },
+ "id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "kind"
+ ],
+ "additionalProperties": false
+ },
+ "operation": {
+ "type": "string",
+ "enum": [
+ "addition",
+ "remaining",
+ "replacement",
+ "withdrawal",
+ "correction",
+ "unresolved"
+ ]
+ },
+ "expected_revision": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "evidence": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "source_id": {
+ "type": "string"
+ },
+ "revision": {
+ "type": "string"
+ },
+ "start": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "end": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "method": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "end",
+ "method",
+ "revision",
+ "source_id",
+ "start"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "target",
+ "operation",
+ "evidence"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "review": {
+ "type": "object",
+ "properties": {
+ "required": {
+ "type": "boolean"
+ },
+ "clarifications": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "field": {
+ "type": "string"
+ },
+ "reason": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "field",
+ "reason"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "clarifications",
+ "required"
+ ],
+ "additionalProperties": false
+ },
+ "execution": {
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "complete",
+ "degraded",
+ "failed"
+ ]
+ },
+ "provider_calls": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "model": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "question_bundle": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "model",
+ "provider_calls",
+ "question_bundle",
+ "status"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "claims",
+ "proposed_changes",
+ "review",
+ "execution"
+ ],
+ "additionalProperties": false
+ },
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "code",
+ "message"
+ ],
+ "additionalProperties": false
+ },
+ "meta": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "required": [
+ "version",
+ "request_id",
+ "ok"
+ ],
+ "additionalProperties": false
+}
diff --git a/schemas/hyf_v1_jev/manifest.json b/schemas/hyf_v1_jev/manifest.json
@@ -0,0 +1,47 @@
+{
+ "schema_version": 1,
+ "spec_id": "hyf_v1_jev",
+ "family": "wire_operations",
+ "note": "Additive operation envelopes. New operations are NOT advertised until S104. Existing wire-v1 envelope is preserved.",
+ "bindings": [
+ {
+ "capability": "farm_update.interpret",
+ "request_schema": "farm_update_interpret.request.schema.json",
+ "request_valid": "examples/valid/farm_update_interpret.request.json",
+ "response_schema": "farm_update_interpret.response.schema.json",
+ "response_valid": "examples/valid/farm_update_interpret.response.json"
+ },
+ {
+ "capability": "buyer_request.interpret",
+ "request_schema": "buyer_request_interpret.request.schema.json",
+ "request_valid": "examples/valid/buyer_request_interpret.request.json",
+ "response_schema": "buyer_request_interpret.response.schema.json",
+ "response_valid": "examples/valid/buyer_request_interpret.response.json"
+ },
+ {
+ "capability": "buyer_request.match",
+ "request_schema": "buyer_request_match.request.schema.json",
+ "request_valid": "examples/valid/buyer_request_match.request.json",
+ "response_schema": "buyer_request_match.response.schema.json",
+ "response_valid": "examples/valid/buyer_request_match.response.json"
+ },
+ {
+ "capability": "farm_update.interpret",
+ "request_schema": "farm_update_interpret.request.schema.json",
+ "request_valid": "examples/valid/farm_update_interpret.request.json",
+ "request_invalid": "examples/invalid/farm_update_interpret.request.unknown_field.json"
+ },
+ {
+ "capability": "buyer_request.interpret",
+ "response_schema": "buyer_request_interpret.response.schema.json",
+ "response_valid": "examples/valid/buyer_request_interpret.response.json",
+ "response_invalid": "examples/invalid/buyer_request_interpret.response.wrong_type.json"
+ },
+ {
+ "capability": "buyer_request.match",
+ "request_schema": "buyer_request_match.request.schema.json",
+ "request_valid": "examples/valid/buyer_request_match.request.json",
+ "request_invalid": "examples/invalid/buyer_request_match.request.bad_eligibility.json"
+ }
+ ]
+}
diff --git a/tests/test_hyf.mojo b/tests/test_hyf.mojo
@@ -9,7 +9,7 @@ from std.testing import (
)
from std.tempfile import TemporaryDirectory
-from json import Value, loads
+from json import Value, loads, validate
from fixture_assertions import (
assert_matches_scenario_response,
@@ -979,5 +979,91 @@ def test_semantic_fixture_manifest_declares_repo_local_family() raises:
assert_equal(Int(manifest["declared_raw_payload_count"].int_value()), 5)
+def _wire_schema_path(name: String) raises -> Path:
+ return _dir_of_current_file() / ".." / "schemas" / "hyf_v1_jev" / name
+
+
+def _wire_schema_json(name: String) raises -> Value:
+ return loads(_wire_schema_path(name).read_text())
+
+
+def test_wire_operation_schemas_accept_valid_and_reject_invalid() raises:
+ var manifest = _wire_schema_json("manifest.json")
+ assert_equal(manifest["schema_version"].int_value(), 1)
+ assert_equal(manifest["spec_id"].string_value(), "hyf_v1_jev")
+
+ var validated = 0
+ for binding in manifest["bindings"].array_items():
+ if _has_key(binding, "request_schema"):
+ var request_schema_name = binding["request_schema"].string_value()
+ var request_valid = binding["request_valid"].string_value()
+ var request_schema = _wire_schema_json(request_schema_name)
+ var request_doc = loads(
+ (
+ _dir_of_current_file()
+ / ".."
+ / "schemas"
+ / "hyf_v1_jev"
+ / request_valid
+ ).read_text()
+ )
+ assert_true(
+ validate(request_doc, request_schema).valid,
+ "request example failed schema: " + request_valid,
+ )
+ validated += 1
+
+ if _has_key(binding, "request_invalid"):
+ var invalid_doc = loads(
+ (
+ _dir_of_current_file()
+ / ".."
+ / "schemas"
+ / "hyf_v1_jev"
+ / binding["request_invalid"].string_value()
+ ).read_text()
+ )
+ assert_true(
+ not validate(invalid_doc, request_schema).valid,
+ "invalid request example unexpectedly passed schema",
+ )
+
+ if _has_key(binding, "response_schema"):
+ var response_schema = _wire_schema_json(
+ binding["response_schema"].string_value()
+ )
+ var response_doc = loads(
+ (
+ _dir_of_current_file()
+ / ".."
+ / "schemas"
+ / "hyf_v1_jev"
+ / binding["response_valid"].string_value()
+ ).read_text()
+ )
+ assert_true(
+ validate(response_doc, response_schema).valid,
+ "response example failed schema",
+ )
+ validated += 1
+
+ if _has_key(binding, "response_invalid"):
+ var invalid_response = loads(
+ (
+ _dir_of_current_file()
+ / ".."
+ / "schemas"
+ / "hyf_v1_jev"
+ / binding["response_invalid"].string_value()
+ ).read_text()
+ )
+ assert_true(
+ not validate(invalid_response, response_schema).valid,
+ "invalid response example unexpectedly passed schema",
+ )
+
+ assert_true(validated >= 6)
+
+
def main() raises:
TestSuite.discover_tests[__functions_in_module()]().run()