Repository navigation
Expand file tree
/
Copy pathtesting_support.py
More file actions
34 lines (30 loc) · 1.9 KB
/
Copy pathtesting_support.py
File metadata and controls
34 lines (30 loc) · 1.9 KB
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
"""Independent public contract shared by offline and deployed-schema checks.
Do not derive expected values from Lathe: a shared implementation mistake
must not silently update its own oracle. Tuple: JSON type, required, default.
"""
EXPECTED_SCHEMA = {
"lathe": {"manpage": ("string", False, "overview")},
"destroy": {},
"onboard": {"path": ("string", True, None)},
"bash": {"command": ("string", True, None), "workdir": ("string", False, "/home/daytona/workspace"),
"foreground_seconds": ("integer", False, -1)},
"read": {"path": ("string", True, None), "start": ("integer", False, 1), "stop": ("integer", False, 0)},
"write": {"path": ("string", True, None), "content": ("string", True, None)},
"edit": {"path": ("string", True, None), "old_string": ("string", True, None),
"new_string": ("string", True, None), "replace_all": ("boolean", False, False)},
"glob": {"pattern": ("string", True, None), "max_lines": ("integer", False, 100)},
"grep": {"pattern": ("string", True, None), "files": ("string", False, "**/*"),
"max_lines": ("integer", False, 100)},
"interpret": {"code": ("string", True, None), "timeout": ("integer", False, 120)},
"view": {"path": ("string", True, None)},
"show": {"paths": ("array", True, None)},
"peek": {"command": ("string", True, None), "args": ("object", False, {})},
"poke": {"command": ("string", True, None), "args": ("object", False, {})},
"expose": {"target": ("string", True, None), "access": ("string", True, None),
"tag": ("string", False, ""), "upstream_headers": ("object", False, {}),
"public_headers_acknowledged": ("boolean", False, False)},
}
def normalize_schema(schema):
required = set(schema.get("required", []))
return {name: (prop.get("type"), name in required, prop.get("default"))
for name, prop in schema.get("properties", {}).items()}