hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

farm_update_interpret.response.schema.json (9811B)


      1 {
      2   "type": "object",
      3   "properties": {
      4     "version": {
      5       "type": "integer",
      6       "const": 1
      7     },
      8     "request_id": {
      9       "type": "string"
     10     },
     11     "trace_id": {
     12       "type": "string",
     13       "minLength": 1,
     14       "pattern": "\\S"
     15     },
     16     "ok": {
     17       "type": "boolean"
     18     },
     19     "output": {
     20       "type": "object",
     21       "properties": {
     22         "versions": {
     23           "$ref": "common.schema.json#/$defs/versions"
     24         },
     25         "provenance": {
     26           "type": "object",
     27           "properties": {
     28             "source": {
     29               "$ref": "common.schema.json#/$defs/identity"
     30             },
     31             "clarification": {
     32               "anyOf": [
     33                 {
     34                   "$ref": "common.schema.json#/$defs/identity"
     35                 },
     36                 {
     37                   "type": "null"
     38                 }
     39               ]
     40             },
     41             "prior_records": {
     42               "type": "array",
     43               "items": {
     44                 "type": "object",
     45                 "properties": {
     46                   "record_id": {
     47                     "type": "string",
     48                     "minLength": 64,
     49                     "maxLength": 64,
     50                     "pattern": "^[0-9a-f]{64}(?![\\s\\S])"
     51                   },
     52                   "revision": {
     53                     "type": "string",
     54                     "minLength": 1,
     55                     "pattern": "\\S"
     56                   }
     57                 },
     58                 "required": [
     59                   "record_id",
     60                   "revision"
     61                 ],
     62                 "additionalProperties": false
     63               },
     64               "maxItems": 128
     65             }
     66           },
     67           "required": [
     68             "source",
     69             "clarification",
     70             "prior_records"
     71           ],
     72           "additionalProperties": false
     73         },
     74         "review": {
     75           "$ref": "common.schema.json#/$defs/review"
     76         },
     77         "execution": {
     78           "$ref": "common.schema.json#/$defs/execution"
     79         },
     80         "claims": {
     81           "type": "array",
     82           "items": {
     83             "type": "object",
     84             "properties": {
     85               "claim_id": {
     86                 "type": "string",
     87                 "minLength": 1
     88               },
     89               "product": {
     90                 "$ref": "common.schema.json#/$defs/product_ref"
     91               },
     92               "status": {
     93                 "type": "string",
     94                 "enum": [
     95                   "offered",
     96                   "forecast",
     97                   "unavailable",
     98                   "correction",
     99                   "unclear"
    100                 ]
    101               },
    102               "quantity": {
    103                 "$ref": "common.schema.json#/$defs/reported_quantity"
    104               },
    105               "evidence": {
    106                 "type": "array",
    107                 "items": {
    108                   "$ref": "common.schema.json#/$defs/evidence_ref"
    109                 },
    110                 "maxItems": 128
    111               },
    112               "review_required": {
    113                 "type": "boolean"
    114               }
    115             },
    116             "required": [
    117               "claim_id",
    118               "product",
    119               "status",
    120               "evidence",
    121               "review_required"
    122             ],
    123             "additionalProperties": false
    124           },
    125           "maxItems": 128
    126         },
    127         "proposed_changes": {
    128           "type": "array",
    129           "items": {
    130             "type": "object",
    131             "properties": {
    132               "target": {
    133                 "type": "object",
    134                 "properties": {
    135                   "kind": {
    136                     "type": "string",
    137                     "enum": [
    138                       "listing",
    139                       "product"
    140                     ]
    141                   },
    142                   "id": {
    143                     "anyOf": [
    144                       {
    145                         "type": "string",
    146                         "minLength": 64,
    147                         "maxLength": 64,
    148                         "pattern": "^[0-9a-f]{64}(?![\\s\\S])"
    149                       },
    150                       {
    151                         "type": "null"
    152                       }
    153                     ]
    154                   }
    155                 },
    156                 "required": [
    157                   "kind",
    158                   "id"
    159                 ],
    160                 "additionalProperties": false
    161               },
    162               "operation": {
    163                 "type": "string",
    164                 "enum": [
    165                   "addition",
    166                   "remaining",
    167                   "replacement",
    168                   "withdrawal",
    169                   "correction",
    170                   "unresolved"
    171                 ]
    172               },
    173               "direction": {
    174                 "type": "string",
    175                 "enum": [
    176                   "increase",
    177                   "decrease",
    178                   "none"
    179                 ]
    180               },
    181               "quantity": {
    182                 "$ref": "common.schema.json#/$defs/reported_quantity"
    183               },
    184               "expected_revision": {
    185                 "anyOf": [
    186                   {
    187                     "type": "string",
    188                     "minLength": 1,
    189                     "pattern": "\\S"
    190                   },
    191                   {
    192                     "type": "null"
    193                   }
    194                 ]
    195               },
    196               "evidence": {
    197                 "type": "array",
    198                 "items": {
    199                   "$ref": "common.schema.json#/$defs/evidence_ref"
    200                 },
    201                 "maxItems": 128
    202               }
    203             },
    204             "required": [
    205               "target",
    206               "operation",
    207               "direction",
    208               "quantity",
    209               "expected_revision",
    210               "evidence"
    211             ],
    212             "additionalProperties": false,
    213             "allOf": [
    214               {
    215                 "if": {
    216                   "properties": {
    217                     "target": {
    218                       "properties": {
    219                         "id": {
    220                           "type": "string"
    221                         }
    222                       },
    223                       "required": [
    224                         "id"
    225                       ]
    226                     }
    227                   },
    228                   "required": [
    229                     "target"
    230                   ]
    231                 },
    232                 "then": {
    233                   "properties": {
    234                     "expected_revision": {
    235                       "type": "string",
    236                       "minLength": 1,
    237                       "pattern": "\\S"
    238                     }
    239                   }
    240                 },
    241                 "else": {
    242                   "properties": {
    243                     "expected_revision": {
    244                       "type": "null"
    245                     }
    246                   }
    247                 }
    248               },
    249               {
    250                 "if": {
    251                   "properties": {
    252                     "operation": {
    253                       "const": "correction"
    254                     }
    255                   },
    256                   "required": [
    257                     "operation"
    258                   ]
    259                 },
    260                 "then": {
    261                   "properties": {
    262                     "direction": {
    263                       "type": "string",
    264                       "enum": [
    265                         "increase",
    266                         "decrease"
    267                       ]
    268                     }
    269                   }
    270                 },
    271                 "else": {
    272                   "properties": {
    273                     "direction": {
    274                       "const": "none"
    275                     }
    276                   }
    277                 }
    278               }
    279             ]
    280           },
    281           "maxItems": 128
    282         }
    283       },
    284       "required": [
    285         "versions",
    286         "provenance",
    287         "review",
    288         "execution",
    289         "claims",
    290         "proposed_changes"
    291       ],
    292       "additionalProperties": false
    293     },
    294     "error": {
    295       "type": "object",
    296       "properties": {
    297         "code": {
    298           "type": "string",
    299           "enum": [
    300             "invalid_request",
    301             "unsupported_capability",
    302             "capability_disabled",
    303             "capability_unavailable",
    304             "internal_error"
    305           ]
    306         },
    307         "message": {
    308           "type": "string"
    309         }
    310       },
    311       "required": [
    312         "code",
    313         "message"
    314       ],
    315       "additionalProperties": false
    316     },
    317     "meta": {
    318       "type": "object",
    319       "properties": {
    320         "schema_version": {
    321           "type": "integer",
    322           "const": 1
    323         }
    324       },
    325       "required": [
    326         "schema_version"
    327       ],
    328       "additionalProperties": false
    329     }
    330   },
    331   "required": [
    332     "version",
    333     "request_id",
    334     "ok"
    335   ],
    336   "additionalProperties": false,
    337   "oneOf": [
    338     {
    339       "properties": {
    340         "ok": {
    341           "const": true
    342         },
    343         "request_id": {
    344           "type": "string",
    345           "minLength": 1,
    346           "pattern": "\\S"
    347         }
    348       },
    349       "required": [
    350         "output"
    351       ],
    352       "not": {
    353         "required": [
    354           "error"
    355         ]
    356       }
    357     },
    358     {
    359       "properties": {
    360         "ok": {
    361           "const": false
    362         }
    363       },
    364       "required": [
    365         "error"
    366       ],
    367       "not": {
    368         "anyOf": [
    369           {
    370             "required": [
    371               "output"
    372             ]
    373           },
    374           {
    375             "required": [
    376               "meta"
    377             ]
    378           }
    379         ]
    380       }
    381     }
    382   ],
    383   "$schema": "https://json-schema.org/draft/2020-12/schema",
    384   "$id": "hyf_ops_v3/farm_update_interpret.response.schema.json",
    385   "$comment": "D57 hyf_ops_v3 pre-activation contract. No business write or trusted context can be minted by source/model text. Full semantic input-use and SDK revalidation remain required."
    386 }