File size: 3,572 Bytes
a0f8a7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://a-11-oy.com/schemas/numerics-contract-v1.json",
  "title": "a11oy external numerical-engine contract v1",
  "request_schema": {
    "type": "object",
    "additionalProperties": false,
    "required": ["schema", "request_id", "operation", "inputs", "tolerance"],
    "properties": {
      "schema": {"const": "szl.numerics.request/v1"},
      "request_id": {"type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$"},
      "operation": {
        "enum": ["MATRIX_SOLVE", "SYMMETRIC_EIGENVALUES", "VALIDATE_REFERENCE_VECTOR"]
      },
      "inputs": {"type": "object"},
      "tolerance": {
        "type": "object",
        "additionalProperties": false,
        "required": ["absolute", "relative"],
        "properties": {
          "absolute": {"type": "number", "minimum": 0, "maximum": 1},
          "relative": {"type": "number", "minimum": 0, "maximum": 1}
        }
      }
    },
    "allOf": [
      {
        "if": {"properties": {"operation": {"const": "SYMMETRIC_EIGENVALUES"}}},
        "then": {
          "properties": {
            "inputs": {
              "type": "object",
              "additionalProperties": false,
              "required": ["matrix"],
              "properties": {"matrix": {"$ref": "#/$defs/matrix"}}
            }
          }
        }
      },
      {
        "if": {"properties": {"operation": {"const": "MATRIX_SOLVE"}}},
        "then": {
          "properties": {
            "inputs": {
              "type": "object",
              "additionalProperties": false,
              "required": ["matrix", "rhs"],
              "properties": {
                "matrix": {"$ref": "#/$defs/matrix"},
                "rhs": {"$ref": "#/$defs/vector"}
              }
            }
          }
        }
      },
      {
        "if": {"properties": {"operation": {"const": "VALIDATE_REFERENCE_VECTOR"}}},
        "then": {
          "properties": {
            "inputs": {
              "type": "object",
              "additionalProperties": false,
              "required": ["matrix", "rhs", "expected"],
              "properties": {
                "matrix": {"$ref": "#/$defs/matrix"},
                "rhs": {"$ref": "#/$defs/vector"},
                "expected": {"$ref": "#/$defs/vector"}
              }
            }
          }
        }
      }
    ]
  },
  "engine_response_schema": {
    "type": "object",
    "additionalProperties": false,
    "required": ["schema", "state", "operation", "values", "substrate_evidence"],
    "properties": {
      "schema": {"const": "szl.numerics.engine-response/v1"},
      "state": {"const": "RESULT"},
      "operation": {
        "enum": ["MATRIX_SOLVE", "SYMMETRIC_EIGENVALUES", "VALIDATE_REFERENCE_VECTOR"]
      },
      "values": {"$ref": "#/$defs/vector"},
      "substrate_evidence": {"enum": ["MEASURED", "UNKNOWN"]}
    }
  },
  "matlab_external_service_cli": [
    "ABSOLUTE_OPERATOR_CONFIGURED_EXECUTABLE",
    "--json-input",
    "HOST_TEMP_REQUEST_PATH",
    "--json-output",
    "HOST_TEMP_RESPONSE_PATH"
  ],
  "prohibited_fields": ["code", "expression", "function", "command", "path", "package", "url"],
  "$defs": {
    "number": {"type": "number", "minimum": -1000000000000, "maximum": 1000000000000},
    "vector": {
      "type": "array",
      "minItems": 1,
      "maxItems": 64,
      "items": {"$ref": "#/$defs/number"}
    },
    "matrix": {
      "type": "array",
      "minItems": 1,
      "maxItems": 64,
      "items": {"$ref": "#/$defs/vector"}
    }
  }
}