Skip to content

Commit f0e0e27

Browse files
committed
Extract duplicated schema definitions to common.schema.json
Move 7 shared type definitions (frame, runtimeActionName, runtimeElementRole, runtimeElementState, runtimeElement, compactRuntimeSnapshot, recoverableUiError) from capture-result and ui-action-result schemas to common.schema.json to eliminate duplication and prevent divergence.
1 parent 0eead99 commit f0e0e27

3 files changed

Lines changed: 125 additions & 243 deletions

File tree

schemas/structured-output/_defs/common.schema.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,124 @@
564564
"minLength": 1
565565
},
566566
"minItems": 1
567+
},
568+
"frame": {
569+
"type": "object",
570+
"additionalProperties": false,
571+
"properties": {
572+
"x": { "type": "number" },
573+
"y": { "type": "number" },
574+
"width": { "type": "number" },
575+
"height": { "type": "number" }
576+
},
577+
"required": ["x", "y", "width", "height"]
578+
},
579+
"runtimeActionName": {
580+
"enum": ["tap", "typeText", "longPress", "touch", "swipeWithin"]
581+
},
582+
"runtimeElementRole": {
583+
"enum": [
584+
"application",
585+
"button",
586+
"cell",
587+
"image",
588+
"keyboard-key",
589+
"list",
590+
"menu",
591+
"other",
592+
"scroll-view",
593+
"slider",
594+
"switch",
595+
"tab",
596+
"text",
597+
"text-field",
598+
"window"
599+
]
600+
},
601+
"runtimeElementState": {
602+
"type": "object",
603+
"additionalProperties": false,
604+
"properties": {
605+
"enabled": { "type": "boolean" },
606+
"focused": { "type": "boolean" },
607+
"selected": { "type": "boolean" },
608+
"visible": { "type": "boolean" }
609+
}
610+
},
611+
"runtimeElement": {
612+
"type": "object",
613+
"additionalProperties": false,
614+
"properties": {
615+
"ref": { "type": "string", "pattern": "^e[1-9][0-9]*$" },
616+
"role": { "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/runtimeElementRole" },
617+
"label": { "type": "string" },
618+
"value": { "type": "string" },
619+
"identifier": { "type": "string" },
620+
"frame": { "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/frame" },
621+
"state": { "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/runtimeElementState" },
622+
"actions": {
623+
"type": "array",
624+
"items": { "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/runtimeActionName" }
625+
}
626+
},
627+
"required": ["ref", "frame", "actions"]
628+
},
629+
"compactRuntimeSnapshot": {
630+
"type": "object",
631+
"additionalProperties": false,
632+
"properties": {
633+
"type": { "const": "runtime-snapshot" },
634+
"rs": { "const": "1" },
635+
"screenHash": { "type": "string", "minLength": 1 },
636+
"seq": { "type": "integer", "minimum": 0 },
637+
"count": { "type": "integer", "minimum": 0 },
638+
"targets": {
639+
"type": "array",
640+
"items": { "type": "string" }
641+
},
642+
"scroll": {
643+
"type": "array",
644+
"items": { "type": "string" }
645+
},
646+
"text": {
647+
"type": "array",
648+
"items": { "type": "string" }
649+
},
650+
"udid": { "type": "string" }
651+
},
652+
"required": ["type", "rs", "screenHash", "seq", "count", "targets", "scroll", "udid"]
653+
},
654+
"recoverableUiError": {
655+
"type": "object",
656+
"additionalProperties": false,
657+
"properties": {
658+
"code": {
659+
"enum": [
660+
"SNAPSHOT_MISSING",
661+
"SNAPSHOT_EXPIRED",
662+
"SNAPSHOT_PARSE_FAILED",
663+
"ELEMENT_REF_NOT_FOUND",
664+
"TARGET_NOT_FOUND",
665+
"TARGET_AMBIGUOUS",
666+
"TARGET_NOT_ACTIONABLE",
667+
"WAIT_TIMEOUT",
668+
"UI_STATE_CHANGED",
669+
"ACTION_FAILED"
670+
]
671+
},
672+
"message": { "type": "string" },
673+
"recoveryHint": { "type": "string" },
674+
"elementRef": { "type": "string" },
675+
"candidates": {
676+
"type": "array",
677+
"items": {
678+
"oneOf": [{ "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/runtimeElement" }, { "type": "string" }]
679+
}
680+
},
681+
"snapshotAgeMs": { "type": "integer", "minimum": 0 },
682+
"timeoutMs": { "type": "integer", "minimum": 0 }
683+
},
684+
"required": ["code", "message", "recoveryHint"]
567685
}
568686
}
569687
}

schemas/structured-output/xcodebuildmcp.output.capture-result/2.schema.json

Lines changed: 5 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@
99
}
1010
],
1111
"$defs": {
12-
"frame": {
13-
"type": "object",
14-
"additionalProperties": false,
15-
"properties": {
16-
"x": { "type": "number" },
17-
"y": { "type": "number" },
18-
"width": { "type": "number" },
19-
"height": { "type": "number" }
20-
},
21-
"required": ["x", "y", "width", "height"]
22-
},
2312
"uiHierarchyNode": {
2413
"type": "object"
2514
},
@@ -35,61 +24,11 @@
3524
},
3625
"required": ["type", "uiHierarchy"]
3726
},
38-
"runtimeActionName": {
39-
"enum": ["tap", "typeText", "longPress", "touch", "swipeWithin"]
40-
},
41-
"runtimeElementRole": {
42-
"enum": [
43-
"application",
44-
"button",
45-
"cell",
46-
"image",
47-
"keyboard-key",
48-
"list",
49-
"menu",
50-
"other",
51-
"scroll-view",
52-
"slider",
53-
"switch",
54-
"tab",
55-
"text",
56-
"text-field",
57-
"window"
58-
]
59-
},
60-
"runtimeElementState": {
61-
"type": "object",
62-
"additionalProperties": false,
63-
"properties": {
64-
"enabled": { "type": "boolean" },
65-
"focused": { "type": "boolean" },
66-
"selected": { "type": "boolean" },
67-
"visible": { "type": "boolean" }
68-
}
69-
},
70-
"runtimeElement": {
71-
"type": "object",
72-
"additionalProperties": false,
73-
"properties": {
74-
"ref": { "type": "string", "pattern": "^e[1-9][0-9]*$" },
75-
"role": { "$ref": "#/$defs/runtimeElementRole" },
76-
"label": { "type": "string" },
77-
"value": { "type": "string" },
78-
"identifier": { "type": "string" },
79-
"frame": { "$ref": "#/$defs/frame" },
80-
"state": { "$ref": "#/$defs/runtimeElementState" },
81-
"actions": {
82-
"type": "array",
83-
"items": { "$ref": "#/$defs/runtimeActionName" }
84-
}
85-
},
86-
"required": ["ref", "frame", "actions"]
87-
},
8827
"runtimeActionHint": {
8928
"type": "object",
9029
"additionalProperties": false,
9130
"properties": {
92-
"action": { "$ref": "#/$defs/runtimeActionName" },
31+
"action": { "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/runtimeActionName" },
9332
"elementRef": { "type": "string", "pattern": "^e[1-9][0-9]*$" },
9433
"label": { "type": "string" }
9534
},
@@ -108,7 +47,7 @@
10847
"expiresAtMs": { "type": "integer", "minimum": 0 },
10948
"elements": {
11049
"type": "array",
111-
"items": { "$ref": "#/$defs/runtimeElement" }
50+
"items": { "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/runtimeElement" }
11251
},
11352
"actions": {
11453
"type": "array",
@@ -127,31 +66,6 @@
12766
"actions"
12867
]
12968
},
130-
"compactRuntimeSnapshot": {
131-
"type": "object",
132-
"additionalProperties": false,
133-
"properties": {
134-
"type": { "const": "runtime-snapshot" },
135-
"rs": { "const": "1" },
136-
"screenHash": { "type": "string", "minLength": 1 },
137-
"seq": { "type": "integer", "minimum": 0 },
138-
"count": { "type": "integer", "minimum": 0 },
139-
"targets": {
140-
"type": "array",
141-
"items": { "type": "string" }
142-
},
143-
"scroll": {
144-
"type": "array",
145-
"items": { "type": "string" }
146-
},
147-
"text": {
148-
"type": "array",
149-
"items": { "type": "string" }
150-
},
151-
"udid": { "type": "string" }
152-
},
153-
"required": ["type", "rs", "screenHash", "seq", "count", "targets", "scroll", "udid"]
154-
},
15569
"runtimeSnapshotUnchanged": {
15670
"type": "object",
15771
"additionalProperties": false,
@@ -200,43 +114,11 @@
200114
"matches": {
201115
"type": "array",
202116
"items": {
203-
"oneOf": [{ "$ref": "#/$defs/runtimeElement" }, { "type": "string" }]
117+
"oneOf": [{ "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/runtimeElement" }, { "type": "string" }]
204118
}
205119
}
206120
},
207121
"required": ["predicate", "matches"]
208-
},
209-
"recoverableUiError": {
210-
"type": "object",
211-
"additionalProperties": false,
212-
"properties": {
213-
"code": {
214-
"enum": [
215-
"SNAPSHOT_MISSING",
216-
"SNAPSHOT_EXPIRED",
217-
"SNAPSHOT_PARSE_FAILED",
218-
"ELEMENT_REF_NOT_FOUND",
219-
"TARGET_NOT_FOUND",
220-
"TARGET_AMBIGUOUS",
221-
"TARGET_NOT_ACTIONABLE",
222-
"WAIT_TIMEOUT",
223-
"UI_STATE_CHANGED",
224-
"ACTION_FAILED"
225-
]
226-
},
227-
"message": { "type": "string" },
228-
"recoveryHint": { "type": "string" },
229-
"elementRef": { "type": "string" },
230-
"candidates": {
231-
"type": "array",
232-
"items": {
233-
"oneOf": [{ "$ref": "#/$defs/runtimeElement" }, { "type": "string" }]
234-
}
235-
},
236-
"snapshotAgeMs": { "type": "integer", "minimum": 0 },
237-
"timeoutMs": { "type": "integer", "minimum": 0 }
238-
},
239-
"required": ["code", "message", "recoveryHint"]
240122
}
241123
},
242124
"properties": {
@@ -274,7 +156,7 @@
274156
},
275157
{ "$ref": "#/$defs/uiHierarchyCapture" },
276158
{ "$ref": "#/$defs/runtimeSnapshot" },
277-
{ "$ref": "#/$defs/compactRuntimeSnapshot" },
159+
{ "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/compactRuntimeSnapshot" },
278160
{ "$ref": "#/$defs/videoRecordingCapture" },
279161
{ "$ref": "#/$defs/runtimeSnapshotUnchanged" },
280162
{ "$ref": "#/$defs/compactRuntimeSnapshotUnchanged" }
@@ -283,7 +165,7 @@
283165
"diagnostics": {
284166
"$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/basicDiagnostics"
285167
},
286-
"uiError": { "$ref": "#/$defs/recoverableUiError" },
168+
"uiError": { "$ref": "https://xcodebuildmcp.com/schemas/structured-output/_defs/common.schema.json#/$defs/recoverableUiError" },
287169
"waitMatch": { "$ref": "#/$defs/waitMatch" }
288170
},
289171
"required": ["summary", "artifacts"]

0 commit comments

Comments
 (0)