ods-validator 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. ods_validator/__init__.py +3 -0
  2. ods_validator/__main__.py +48 -0
  3. ods_validator/_schemas/SessionStartedEvent.schema.json +61 -0
  4. ods_validator/_schemas/VERSION.json +5 -0
  5. ods_validator/_schemas/__init__.py +0 -0
  6. ods_validator/_schemas/actuatorStateEvent.schema.json +84 -0
  7. ods_validator/_schemas/alertActionCommand.schema.json +62 -0
  8. ods_validator/_schemas/alertActionReply.schema.json +88 -0
  9. ods_validator/_schemas/alertCommand.schema.json +60 -0
  10. ods_validator/_schemas/alertEvent.schema.json +105 -0
  11. ods_validator/_schemas/alertReply.schema.json +84 -0
  12. ods_validator/_schemas/alertsQuery.schema.json +49 -0
  13. ods_validator/_schemas/alertsReply.schema.json +164 -0
  14. ods_validator/_schemas/artifactPublishedEvent.schema.json +70 -0
  15. ods_validator/_schemas/audioChunkEvent.schema.json +64 -0
  16. ods_validator/_schemas/calibrationEvent.schema.json +122 -0
  17. ods_validator/_schemas/cameraQualityQuery.schema.json +31 -0
  18. ods_validator/_schemas/cameraQualityReply.schema.json +105 -0
  19. ods_validator/_schemas/captureCommand.schema.json +82 -0
  20. ods_validator/_schemas/captureReply.schema.json +84 -0
  21. ods_validator/_schemas/clipEvent.schema.json +88 -0
  22. ods_validator/_schemas/clipQuery.schema.json +44 -0
  23. ods_validator/_schemas/clipReply.schema.json +143 -0
  24. ods_validator/_schemas/codeReadEvent.schema.json +57 -0
  25. ods_validator/_schemas/detectionsEvent.schema.json +75 -0
  26. ods_validator/_schemas/entityEvent.schema.json +122 -0
  27. ods_validator/_schemas/eventMetricsEvent.schema.json +65 -0
  28. ods_validator/_schemas/facialMarkerEvent.schema.json +50 -0
  29. ods_validator/_schemas/frameEvent.schema.json +68 -0
  30. ods_validator/_schemas/heatmapQuery.schema.json +61 -0
  31. ods_validator/_schemas/heatmapReply.schema.json +140 -0
  32. ods_validator/_schemas/keypointsEvent.schema.json +115 -0
  33. ods_validator/_schemas/lexiconCaptureCommand.schema.json +45 -0
  34. ods_validator/_schemas/lexiconCaptureReply.schema.json +110 -0
  35. ods_validator/_schemas/metricsQuery.schema.json +58 -0
  36. ods_validator/_schemas/metricsReply.schema.json +186 -0
  37. ods_validator/_schemas/moveCommand.schema.json +45 -0
  38. ods_validator/_schemas/moveReply.schema.json +101 -0
  39. ods_validator/_schemas/pieceAnalysisEvent.schema.json +97 -0
  40. ods_validator/_schemas/plateReadEvent.schema.json +128 -0
  41. ods_validator/_schemas/positionEvent.schema.json +82 -0
  42. ods_validator/_schemas/ppeComplianceEvent.schema.json +100 -0
  43. ods_validator/_schemas/qualifiedEvent.schema.json +100 -0
  44. ods_validator/_schemas/recordCommand.schema.json +72 -0
  45. ods_validator/_schemas/recordReply.schema.json +96 -0
  46. ods_validator/_schemas/recordingsQuery.schema.json +39 -0
  47. ods_validator/_schemas/recordingsReply.schema.json +119 -0
  48. ods_validator/_schemas/replayCommand.schema.json +96 -0
  49. ods_validator/_schemas/replayReply.schema.json +109 -0
  50. ods_validator/_schemas/replayStateEvent.schema.json +54 -0
  51. ods_validator/_schemas/rulesCommand.schema.json +83 -0
  52. ods_validator/_schemas/rulesReply.schema.json +86 -0
  53. ods_validator/_schemas/signEvent.schema.json +71 -0
  54. ods_validator/_schemas/synthesisCommand.schema.json +61 -0
  55. ods_validator/_schemas/synthesisReply.schema.json +153 -0
  56. ods_validator/_schemas/tracksEvent.schema.json +93 -0
  57. ods_validator/_schemas/transcriptEvent.schema.json +96 -0
  58. ods_validator/_schemas/zoneMetricsEvent.schema.json +71 -0
  59. ods_validator/_schemas/zoneOccupancyEvent.schema.json +62 -0
  60. ods_validator/_schemas/zoneTransitionEvent.schema.json +74 -0
  61. ods_validator/validator.py +112 -0
  62. ods_validator-0.1.0.dist-info/METADATA +109 -0
  63. ods_validator-0.1.0.dist-info/RECORD +67 -0
  64. ods_validator-0.1.0.dist-info/WHEEL +5 -0
  65. ods_validator-0.1.0.dist-info/entry_points.txt +2 -0
  66. ods_validator-0.1.0.dist-info/licenses/LICENSE +21 -0
  67. ods_validator-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3 @@
1
+ from .validator import ENV_SCHEMAS_DIR, ContractError, Validator, publish
2
+
3
+ __all__ = ["Validator", "ContractError", "publish", "ENV_SCHEMAS_DIR"]
@@ -0,0 +1,48 @@
1
+ import argparse
2
+ import json
3
+ import sys
4
+
5
+ from . import Validator
6
+
7
+
8
+ def main(argv=None) -> int:
9
+ parser = argparse.ArgumentParser(prog="ods-validate")
10
+ parser.add_argument("--schemas", help="pasta dos schemas (ou ODS_SCHEMAS_DIR)")
11
+ parser.add_argument("--topic", help="força o tópico (padrão: campo 'schema')")
12
+ parser.add_argument("--info", action="store_true", help="mostra de onde vêm os schemas")
13
+ parser.add_argument("files", nargs="*", help="arquivos JSON (- para stdin)")
14
+ args = parser.parse_args(argv)
15
+ validator = Validator(args.schemas)
16
+ if args.info:
17
+ for key, value in validator.schemas_version.items():
18
+ print(f"{key}: {value}")
19
+ if not args.files:
20
+ return 0
21
+ if not args.files:
22
+ parser.error("informe ao menos um arquivo (ou use --info)")
23
+ status = 0
24
+ for name in args.files:
25
+ text = sys.stdin.read() if name == "-" else open(name, encoding="utf-8").read()
26
+ try:
27
+ message = json.loads(text)
28
+ except json.JSONDecodeError as e:
29
+ print(f"{name}: JSON inválido ({e})")
30
+ status = 1
31
+ continue
32
+ errors = (
33
+ validator.find_errors(args.topic, message)
34
+ if args.topic
35
+ else validator.find_message_errors(message)
36
+ )
37
+ if errors:
38
+ status = 1
39
+ print(f"{name}: INVÁLIDA")
40
+ for e in errors:
41
+ print(" -", e)
42
+ else:
43
+ print(f"{name}: ok")
44
+ return status
45
+
46
+
47
+ if __name__ == "__main__":
48
+ sys.exit(main())
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "SessionStartedEvent",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.session.started"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "event"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "payload": {
18
+ "type": "object",
19
+ "properties": {
20
+ "mode": {
21
+ "type": "string",
22
+ "enum": ["REPLAY", "LIVE"]
23
+ },
24
+ "started_at": {
25
+ "type": "string",
26
+ "format": "date-time"
27
+ },
28
+ "sources": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "string"
32
+ }
33
+ },
34
+ "recording_id": {
35
+ "type": "string"
36
+ },
37
+ "previous_session_id": {
38
+ "type": "string",
39
+ "format": "uuid"
40
+ },
41
+ "reason": {
42
+ "type": "string",
43
+ "enum": ["SEEK", "START", "RESTART", "LOOP", "RECONNECT"]
44
+ }
45
+ },
46
+ "required": [
47
+ "mode",
48
+ "started_at",
49
+ "sources"
50
+ ],
51
+ "additionalProperties": false
52
+ }
53
+ },
54
+ "required": [
55
+ "schema",
56
+ "message_type",
57
+ "producer",
58
+ "payload"
59
+ ],
60
+ "additionalProperties": false
61
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "commit": "cfe6cd908fdb1e5cbf1640fbdba5680cf16a0e3c",
3
+ "description": "v0.1.0",
4
+ "generated_at": "2026-11-17T23:02:53+00:00"
5
+ }
File without changes
@@ -0,0 +1,84 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "ActuatorStateEvent",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.p7.state"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "event"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "source_id": {
18
+ "type": "string"
19
+ },
20
+ "payload": {
21
+ "type": "object",
22
+ "properties": {
23
+ "pan_deg": {
24
+ "type": "number"
25
+ },
26
+ "tilt_deg": {
27
+ "type": "number"
28
+ },
29
+ "state": {
30
+ "type": "string",
31
+ "enum": ["IDLE", "MOVING", "HOMING", "ERROR"]
32
+ },
33
+ "is_homed": {
34
+ "type": "boolean"
35
+ },
36
+ "last_command_id": {
37
+ "type": "string",
38
+ "format": "uuid"
39
+ },
40
+ "error": {
41
+ "type": "object",
42
+ "properties": {
43
+ "code": {
44
+ "type": "string",
45
+ "enum": [
46
+ "OUT_OF_RANGE",
47
+ "NOT_HOMED",
48
+ "LIMIT_SWITCH_REACHED",
49
+ "DEVICE_ERROR"
50
+ ]
51
+ },
52
+ "message": {
53
+ "type": "string"
54
+ }
55
+ },
56
+ "required": ["code", "message"]
57
+ }
58
+ },
59
+ "required": ["pan_deg", "tilt_deg", "state", "is_homed"],
60
+ "allOf": [
61
+ {
62
+ "if": {
63
+ "properties": {
64
+ "state": {
65
+ "const": "ERROR"
66
+ }
67
+ },
68
+ "required": ["state"]
69
+ },
70
+ "then": {
71
+ "required": ["error"]
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ "required": [
78
+ "schema",
79
+ "message_type",
80
+ "producer",
81
+ "source_id",
82
+ "payload"
83
+ ]
84
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AlertActionCommand",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.s3.alert_action.command"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "command"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "target": {
18
+ "type": "string"
19
+ },
20
+ "payload": {
21
+ "type": "object",
22
+ "properties": {
23
+ "alert_id": {
24
+ "type": "string",
25
+ "format": "uuid"
26
+ },
27
+ "action": {
28
+ "type": "string",
29
+ "enum": ["ACKNOWLEDGE", "MUTE", "CLOSE"]
30
+ },
31
+ "actor": {
32
+ "type": "string",
33
+ "pattern": "^user:.+$"
34
+ },
35
+ "mute_until": {
36
+ "type": "string",
37
+ "format": "date-time"
38
+ },
39
+ "reason": {
40
+ "type": "string"
41
+ }
42
+ },
43
+ "required": ["alert_id", "action", "actor"],
44
+ "allOf": [
45
+ {
46
+ "if": {
47
+ "properties": {
48
+ "action": {
49
+ "const": "MUTE"
50
+ }
51
+ },
52
+ "required": ["action"]
53
+ },
54
+ "then": {
55
+ "required": ["mute_until"]
56
+ }
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ "required": ["schema", "message_type", "producer", "target", "payload"]
62
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AlertActionReply",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.s3.alert_action.reply"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "reply"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "correlation_id": {
18
+ "type": "string",
19
+ "format": "uuid"
20
+ },
21
+ "payload": {
22
+ "type": "object",
23
+ "properties": {
24
+ "status": {
25
+ "type": "string",
26
+ "enum": ["OK", "ERROR"]
27
+ },
28
+ "alert_id": {
29
+ "type": "string",
30
+ "format": "uuid"
31
+ },
32
+ "state": {
33
+ "type": "string",
34
+ "enum": ["CREATED", "ACKNOWLEDGED", "MUTED", "CLOSED"]
35
+ },
36
+ "error": {
37
+ "type": "object",
38
+ "properties": {
39
+ "code": {
40
+ "type": "string",
41
+ "enum": ["ALERT_NOT_FOUND", "INVALID_TRANSITION"]
42
+ },
43
+ "message": {
44
+ "type": "string"
45
+ }
46
+ },
47
+ "required": ["code", "message"]
48
+ }
49
+ },
50
+ "required": ["status"],
51
+ "allOf": [
52
+ {
53
+ "if": {
54
+ "properties": {
55
+ "status": {
56
+ "const": "OK"
57
+ }
58
+ },
59
+ "required": ["status"]
60
+ },
61
+ "then": {
62
+ "required": ["alert_id", "state"]
63
+ }
64
+ },
65
+ {
66
+ "if": {
67
+ "properties": {
68
+ "status": {
69
+ "const": "ERROR"
70
+ }
71
+ },
72
+ "required": ["status"]
73
+ },
74
+ "then": {
75
+ "required": ["error"]
76
+ }
77
+ }
78
+ ]
79
+ }
80
+ },
81
+ "required": [
82
+ "schema",
83
+ "message_type",
84
+ "producer",
85
+ "correlation_id",
86
+ "payload"
87
+ ]
88
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AlertCommand",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.s3.alert.command"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "command"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "target": {
18
+ "type": "string"
19
+ },
20
+ "payload": {
21
+ "type": "object",
22
+ "properties": {
23
+ "event_id": {
24
+ "type": "string",
25
+ "format": "uuid"
26
+ },
27
+ "title": {
28
+ "type": "string"
29
+ },
30
+ "message": {
31
+ "type": "string"
32
+ },
33
+ "severity": {
34
+ "type": "string",
35
+ "enum": ["HIGH", "MEDIUM", "LOW"]
36
+ },
37
+ "recipients": {
38
+ "type": "array",
39
+ "items": {
40
+ "type": "string",
41
+ "pattern": "^(user|group|role):.+$"
42
+ }
43
+ },
44
+ "channels": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "string",
48
+ "enum": ["SOUND", "SCREEN", "PUSH"]
49
+ }
50
+ },
51
+ "clip_id": {
52
+ "type": "string",
53
+ "format": "uuid"
54
+ }
55
+ },
56
+ "required": ["title", "message", "severity", "recipients", "channels"]
57
+ }
58
+ },
59
+ "required": ["schema", "message_type", "producer", "target", "payload"]
60
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AlertEvent",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.s3.alert"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "event"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "artifact_version": {
18
+ "type": "string"
19
+ },
20
+ "payload": {
21
+ "type": "object",
22
+ "properties": {
23
+ "alert_id": {
24
+ "type": "string",
25
+ "format": "uuid"
26
+ },
27
+ "event_id": {
28
+ "type": "string",
29
+ "format": "uuid"
30
+ },
31
+ "title": {
32
+ "type": "string"
33
+ },
34
+ "message": {
35
+ "type": "string"
36
+ },
37
+ "severity": {
38
+ "type": "string",
39
+ "enum": ["HIGH", "MEDIUM", "LOW"]
40
+ },
41
+ "recipients": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string",
45
+ "pattern": "^(user|group|role):.+$"
46
+ }
47
+ },
48
+ "channels": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string",
52
+ "enum": ["SOUND", "SCREEN", "PUSH"]
53
+ }
54
+ },
55
+ "clip_id": {
56
+ "type": "string",
57
+ "format": "uuid"
58
+ },
59
+ "state": {
60
+ "type": "string",
61
+ "enum": ["CREATED", "ACKNOWLEDGED", "MUTED", "CLOSED"]
62
+ },
63
+ "created_at": {
64
+ "type": "string",
65
+ "format": "date-time"
66
+ },
67
+ "acknowledged_by": {
68
+ "type": "string"
69
+ },
70
+ "acknowledged_at": {
71
+ "type": "string",
72
+ "format": "date-time"
73
+ },
74
+ "muted_until": {
75
+ "type": "string",
76
+ "format": "date-time"
77
+ },
78
+ "closed_by": {
79
+ "type": "string"
80
+ },
81
+ "closed_at": {
82
+ "type": "string",
83
+ "format": "date-time"
84
+ }
85
+ },
86
+ "required": [
87
+ "alert_id",
88
+ "title",
89
+ "message",
90
+ "severity",
91
+ "recipients",
92
+ "channels",
93
+ "state",
94
+ "created_at"
95
+ ]
96
+ }
97
+ },
98
+ "required": [
99
+ "schema",
100
+ "message_type",
101
+ "producer",
102
+ "artifact_version",
103
+ "payload"
104
+ ]
105
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AlertReply",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.s3.alert.reply"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "reply"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "correlation_id": {
18
+ "type": "string",
19
+ "format": "uuid"
20
+ },
21
+ "payload": {
22
+ "type": "object",
23
+ "properties": {
24
+ "status": {
25
+ "type": "string",
26
+ "enum": ["OK", "ERROR"]
27
+ },
28
+ "alert_id": {
29
+ "type": "string",
30
+ "format": "uuid"
31
+ },
32
+ "error": {
33
+ "type": "object",
34
+ "properties": {
35
+ "code": {
36
+ "type": "string",
37
+ "enum": ["INVALID_RECIPIENT", "INVALID_CHANNEL"]
38
+ },
39
+ "message": {
40
+ "type": "string"
41
+ }
42
+ },
43
+ "required": ["code", "message"]
44
+ }
45
+ },
46
+ "required": ["status"],
47
+ "allOf": [
48
+ {
49
+ "if": {
50
+ "properties": {
51
+ "status": {
52
+ "const": "OK"
53
+ }
54
+ },
55
+ "required": ["status"]
56
+ },
57
+ "then": {
58
+ "required": ["alert_id"]
59
+ }
60
+ },
61
+ {
62
+ "if": {
63
+ "properties": {
64
+ "status": {
65
+ "const": "ERROR"
66
+ }
67
+ },
68
+ "required": ["status"]
69
+ },
70
+ "then": {
71
+ "required": ["error"]
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ "required": [
78
+ "schema",
79
+ "message_type",
80
+ "producer",
81
+ "correlation_id",
82
+ "payload"
83
+ ]
84
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AlertsQuery",
4
+ "type": "object",
5
+ "properties": {
6
+ "schema": {
7
+ "type": "string",
8
+ "const": "ods.s3.alerts.query"
9
+ },
10
+ "message_type": {
11
+ "type": "string",
12
+ "const": "query"
13
+ },
14
+ "producer": {
15
+ "type": "string"
16
+ },
17
+ "target": {
18
+ "type": "string"
19
+ },
20
+ "payload": {
21
+ "type": "object",
22
+ "properties": {
23
+ "from_at": {
24
+ "type": "string",
25
+ "format": "date-time"
26
+ },
27
+ "to_at": {
28
+ "type": "string",
29
+ "format": "date-time"
30
+ },
31
+ "state": {
32
+ "type": "string",
33
+ "enum": ["CREATED", "ACKNOWLEDGED", "MUTED", "CLOSED"]
34
+ },
35
+ "severity": {
36
+ "type": "string",
37
+ "enum": ["HIGH", "MEDIUM", "LOW"]
38
+ },
39
+ "limit": {
40
+ "type": "integer",
41
+ "minimum": 1,
42
+ "maximum": 500
43
+ }
44
+ },
45
+ "required": []
46
+ }
47
+ },
48
+ "required": ["schema", "message_type", "producer", "target", "payload"]
49
+ }