auragrid-api 4.3.0__tar.gz
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.
- auragrid_api-4.3.0/LICENSE +21 -0
- auragrid_api-4.3.0/PKG-INFO +33 -0
- auragrid_api-4.3.0/README.md +20 -0
- auragrid_api-4.3.0/pyproject.toml +25 -0
- auragrid_api-4.3.0/setup.cfg +4 -0
- auragrid_api-4.3.0/src/auragrid_api/__init__.py +104 -0
- auragrid_api-4.3.0/src/auragrid_api.egg-info/PKG-INFO +33 -0
- auragrid_api-4.3.0/src/auragrid_api.egg-info/SOURCES.txt +10 -0
- auragrid_api-4.3.0/src/auragrid_api.egg-info/dependency_links.txt +1 -0
- auragrid_api-4.3.0/src/auragrid_api.egg-info/requires.txt +4 -0
- auragrid_api-4.3.0/src/auragrid_api.egg-info/top_level.txt +1 -0
- auragrid_api-4.3.0/tests/test_schemas_and_vectors.py +199 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AuraCoreDynamics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: auragrid-api
|
|
3
|
+
Version: 4.3.0
|
|
4
|
+
Summary: Canonical wire contracts, JSON Schemas, OpenAPI 3.1 specifications, protocol docs, and golden test vectors for the AuraCore ecosystem
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
11
|
+
Requires-Dist: jsonschema>=4.20; extra == "dev"
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# `auragrid-api`
|
|
15
|
+
|
|
16
|
+
Canonical JSON Schemas, OpenAPI 3.1 specifications, wire protocol documentation, and golden test vectors shared by:
|
|
17
|
+
- **AuraGrid** (.NET 10)
|
|
18
|
+
- **auragrid-py** (Python MAS SDK)
|
|
19
|
+
- **AuraSprout** (User-Space App Distribution & Collaborative Runtime)
|
|
20
|
+
|
|
21
|
+
## Package API
|
|
22
|
+
```python
|
|
23
|
+
from auragrid_api import get_schema_path, get_openapi_path, load_schema, load_openapi
|
|
24
|
+
|
|
25
|
+
manifest_schema = load_schema("app.manifest.schema.json")
|
|
26
|
+
ipc_spec = load_openapi("ipc-bridge.openapi.json")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Layout
|
|
30
|
+
- `schemas/` — `app.manifest.schema.json`, `service-descriptor.schema.json`, `catalog.schema.json`, `lease-collaboration.schema.json`
|
|
31
|
+
- `openapi/` — `ipc-bridge.openapi.json`, `aurasprout-management.openapi.json`
|
|
32
|
+
- `docs/` — `ipc-protocol.md`, `package-and-catalog-spec.md`, `collaborative-shared-processing.md`
|
|
33
|
+
- `fixtures/wire_vectors/` — Golden JSON payloads verified by `tests/test_schemas_and_vectors.py`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# `auragrid-api`
|
|
2
|
+
|
|
3
|
+
Canonical JSON Schemas, OpenAPI 3.1 specifications, wire protocol documentation, and golden test vectors shared by:
|
|
4
|
+
- **AuraGrid** (.NET 10)
|
|
5
|
+
- **auragrid-py** (Python MAS SDK)
|
|
6
|
+
- **AuraSprout** (User-Space App Distribution & Collaborative Runtime)
|
|
7
|
+
|
|
8
|
+
## Package API
|
|
9
|
+
```python
|
|
10
|
+
from auragrid_api import get_schema_path, get_openapi_path, load_schema, load_openapi
|
|
11
|
+
|
|
12
|
+
manifest_schema = load_schema("app.manifest.schema.json")
|
|
13
|
+
ipc_spec = load_openapi("ipc-bridge.openapi.json")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Layout
|
|
17
|
+
- `schemas/` — `app.manifest.schema.json`, `service-descriptor.schema.json`, `catalog.schema.json`, `lease-collaboration.schema.json`
|
|
18
|
+
- `openapi/` — `ipc-bridge.openapi.json`, `aurasprout-management.openapi.json`
|
|
19
|
+
- `docs/` — `ipc-protocol.md`, `package-and-catalog-spec.md`, `collaborative-shared-processing.md`
|
|
20
|
+
- `fixtures/wire_vectors/` — Golden JSON payloads verified by `tests/test_schemas_and_vectors.py`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "auragrid-api"
|
|
7
|
+
version = "4.3.0"
|
|
8
|
+
description = "Canonical wire contracts, JSON Schemas, OpenAPI 3.1 specifications, protocol docs, and golden test vectors for the AuraCore ecosystem"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
dependencies = []
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
dev = [
|
|
16
|
+
"pytest>=8.0",
|
|
17
|
+
"jsonschema>=4.20",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
where = ["src"]
|
|
22
|
+
include = ["auragrid_api*"]
|
|
23
|
+
|
|
24
|
+
[tool.pytest.ini_options]
|
|
25
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Canonical wire contract path and fixture loaders for ``auragrid-api``.
|
|
2
|
+
|
|
3
|
+
This package contains zero runtime business logic, HTTP servers, or network
|
|
4
|
+
clients. It exposes read-only accessors to canonical JSON Schemas, OpenAPI 3.1
|
|
5
|
+
specifications, and golden wire vectors shared across AuraGrid (.NET 10),
|
|
6
|
+
``auragrid-py``, and ``aurasprout``.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
__version__ = "4.3.0"
|
|
16
|
+
|
|
17
|
+
_PACKAGE_DIR = Path(__file__).resolve().parent
|
|
18
|
+
_REPO_ROOT = _PACKAGE_DIR.parent.parent
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _resolve_root_dir(subdir: str) -> Path:
|
|
22
|
+
"""Resolve a data directory from bundled package data or the repository root."""
|
|
23
|
+
bundled = _PACKAGE_DIR / subdir
|
|
24
|
+
if bundled.is_dir():
|
|
25
|
+
return bundled
|
|
26
|
+
repo_dir = _REPO_ROOT / subdir
|
|
27
|
+
if repo_dir.is_dir():
|
|
28
|
+
return repo_dir
|
|
29
|
+
raise FileNotFoundError(
|
|
30
|
+
f"Contract directory '{subdir}' not found in '{bundled}' or '{repo_dir}'."
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _safe_child(base_dir: Path, name: str) -> Path:
|
|
35
|
+
"""Resolve a filename or relative subpath safely inside ``base_dir``."""
|
|
36
|
+
candidate = (base_dir / name).resolve()
|
|
37
|
+
resolved_base = base_dir.resolve()
|
|
38
|
+
try:
|
|
39
|
+
candidate.relative_to(resolved_base)
|
|
40
|
+
except ValueError as exc:
|
|
41
|
+
raise ValueError(f"Path '{name}' escapes contract directory '{resolved_base}'.") from exc
|
|
42
|
+
if not candidate.is_file():
|
|
43
|
+
raise FileNotFoundError(f"Contract file '{name}' not found under '{resolved_base}'.")
|
|
44
|
+
return candidate
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get_schema_path(name: str) -> Path:
|
|
48
|
+
"""Return the absolute path to a JSON Schema file in ``schemas/``."""
|
|
49
|
+
return _safe_child(_resolve_root_dir("schemas"), name)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def get_openapi_path(name: str) -> Path:
|
|
53
|
+
"""Return the absolute path to an OpenAPI specification file in ``openapi/``."""
|
|
54
|
+
return _safe_child(_resolve_root_dir("openapi"), name)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_fixture_path(name: str) -> Path:
|
|
58
|
+
"""Return the absolute path to a golden fixture file in ``fixtures/wire_vectors/``."""
|
|
59
|
+
return _safe_child(_resolve_root_dir("fixtures") / "wire_vectors", name)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def list_schemas() -> list[str]:
|
|
63
|
+
"""List all JSON Schema filenames shipped by ``auragrid-api``."""
|
|
64
|
+
return sorted(p.name for p in _resolve_root_dir("schemas").glob("*.json"))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def list_openapi_specs() -> list[str]:
|
|
68
|
+
"""List all OpenAPI specification filenames shipped by ``auragrid-api``."""
|
|
69
|
+
return sorted(p.name for p in _resolve_root_dir("openapi").glob("*.json"))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def list_wire_vectors() -> list[str]:
|
|
73
|
+
"""List all golden wire vector filenames shipped under ``fixtures/wire_vectors/``."""
|
|
74
|
+
vectors_dir = _resolve_root_dir("fixtures") / "wire_vectors"
|
|
75
|
+
return sorted(p.name for p in vectors_dir.glob("*.json"))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def load_schema(name: str) -> dict[str, Any]:
|
|
79
|
+
"""Load and parse a canonical JSON Schema dictionary."""
|
|
80
|
+
return json.loads(get_schema_path(name).read_text(encoding="utf-8"))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def load_openapi(name: str) -> dict[str, Any]:
|
|
84
|
+
"""Load and parse a canonical OpenAPI 3.1 specification dictionary."""
|
|
85
|
+
return json.loads(get_openapi_path(name).read_text(encoding="utf-8"))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def load_wire_vector(name: str) -> Any:
|
|
89
|
+
"""Load and parse a golden JSON wire vector."""
|
|
90
|
+
return json.loads(get_fixture_path(name).read_text(encoding="utf-8"))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
__all__ = [
|
|
94
|
+
"__version__",
|
|
95
|
+
"get_fixture_path",
|
|
96
|
+
"get_openapi_path",
|
|
97
|
+
"get_schema_path",
|
|
98
|
+
"list_openapi_specs",
|
|
99
|
+
"list_schemas",
|
|
100
|
+
"list_wire_vectors",
|
|
101
|
+
"load_openapi",
|
|
102
|
+
"load_schema",
|
|
103
|
+
"load_wire_vector",
|
|
104
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: auragrid-api
|
|
3
|
+
Version: 4.3.0
|
|
4
|
+
Summary: Canonical wire contracts, JSON Schemas, OpenAPI 3.1 specifications, protocol docs, and golden test vectors for the AuraCore ecosystem
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
11
|
+
Requires-Dist: jsonschema>=4.20; extra == "dev"
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# `auragrid-api`
|
|
15
|
+
|
|
16
|
+
Canonical JSON Schemas, OpenAPI 3.1 specifications, wire protocol documentation, and golden test vectors shared by:
|
|
17
|
+
- **AuraGrid** (.NET 10)
|
|
18
|
+
- **auragrid-py** (Python MAS SDK)
|
|
19
|
+
- **AuraSprout** (User-Space App Distribution & Collaborative Runtime)
|
|
20
|
+
|
|
21
|
+
## Package API
|
|
22
|
+
```python
|
|
23
|
+
from auragrid_api import get_schema_path, get_openapi_path, load_schema, load_openapi
|
|
24
|
+
|
|
25
|
+
manifest_schema = load_schema("app.manifest.schema.json")
|
|
26
|
+
ipc_spec = load_openapi("ipc-bridge.openapi.json")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Layout
|
|
30
|
+
- `schemas/` — `app.manifest.schema.json`, `service-descriptor.schema.json`, `catalog.schema.json`, `lease-collaboration.schema.json`
|
|
31
|
+
- `openapi/` — `ipc-bridge.openapi.json`, `aurasprout-management.openapi.json`
|
|
32
|
+
- `docs/` — `ipc-protocol.md`, `package-and-catalog-spec.md`, `collaborative-shared-processing.md`
|
|
33
|
+
- `fixtures/wire_vectors/` — Golden JSON payloads verified by `tests/test_schemas_and_vectors.py`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/auragrid_api/__init__.py
|
|
5
|
+
src/auragrid_api.egg-info/PKG-INFO
|
|
6
|
+
src/auragrid_api.egg-info/SOURCES.txt
|
|
7
|
+
src/auragrid_api.egg-info/dependency_links.txt
|
|
8
|
+
src/auragrid_api.egg-info/requires.txt
|
|
9
|
+
src/auragrid_api.egg-info/top_level.txt
|
|
10
|
+
tests/test_schemas_and_vectors.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
auragrid_api
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""Contract and golden wire vector validation tests for ``auragrid-api``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import ast
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
import jsonschema
|
|
11
|
+
from jsonschema import Draft7Validator, FormatChecker
|
|
12
|
+
|
|
13
|
+
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
14
|
+
SRC_DIR = REPO_ROOT / "src"
|
|
15
|
+
if str(SRC_DIR) not in sys.path:
|
|
16
|
+
sys.path.insert(0, str(SRC_DIR))
|
|
17
|
+
|
|
18
|
+
import auragrid_api # noqa: E402
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _collect_refs(node: Any) -> list[str]:
|
|
22
|
+
refs: list[str] = []
|
|
23
|
+
if isinstance(node, dict):
|
|
24
|
+
for key, value in node.items():
|
|
25
|
+
if key == "$ref" and isinstance(value, str):
|
|
26
|
+
refs.append(value)
|
|
27
|
+
else:
|
|
28
|
+
refs.extend(_collect_refs(value))
|
|
29
|
+
elif isinstance(node, list):
|
|
30
|
+
for item in node:
|
|
31
|
+
refs.extend(_collect_refs(item))
|
|
32
|
+
return refs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _resolve_internal_pointer(root: dict[str, Any], ref: str) -> Any:
|
|
36
|
+
if not ref.startswith("#/"):
|
|
37
|
+
raise AssertionError(f"Unsupported external or relative $ref: {ref}")
|
|
38
|
+
current: Any = root
|
|
39
|
+
for token in ref[2:].split("/"):
|
|
40
|
+
token = token.replace("~1", "/").replace("~0", "~")
|
|
41
|
+
if not isinstance(current, dict) or token not in current:
|
|
42
|
+
raise AssertionError(f"Unresolved JSON pointer '{ref}' (missing '{token}')")
|
|
43
|
+
current = current[token]
|
|
44
|
+
return current
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _validate_against_definition(
|
|
48
|
+
root_schema: dict[str, Any],
|
|
49
|
+
definition_name: str,
|
|
50
|
+
payload: Any,
|
|
51
|
+
section: str = "definitions",
|
|
52
|
+
) -> None:
|
|
53
|
+
if section == "components/schemas":
|
|
54
|
+
subschema = {
|
|
55
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
56
|
+
"$ref": f"#/components/schemas/{definition_name}",
|
|
57
|
+
"components": {"schemas": root_schema["components"]["schemas"]},
|
|
58
|
+
}
|
|
59
|
+
else:
|
|
60
|
+
subschema = {
|
|
61
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
62
|
+
"$ref": f"#/{section}/{definition_name}",
|
|
63
|
+
section: root_schema[section],
|
|
64
|
+
}
|
|
65
|
+
validator = Draft7Validator(subschema, format_checker=FormatChecker())
|
|
66
|
+
validator.validate(payload)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_package_contains_zero_runtime_implementation_logic() -> None:
|
|
70
|
+
"""Verify ``auragrid_api`` exposes only contract path and fixture loaders."""
|
|
71
|
+
init_file = SRC_DIR / "auragrid_api" / "__init__.py"
|
|
72
|
+
source = init_file.read_text(encoding="utf-8")
|
|
73
|
+
tree = ast.parse(source)
|
|
74
|
+
|
|
75
|
+
imported_modules: set[str] = set()
|
|
76
|
+
for node in ast.walk(tree):
|
|
77
|
+
if isinstance(node, ast.Import):
|
|
78
|
+
imported_modules.update(alias.name for alias in node.names)
|
|
79
|
+
elif isinstance(node, ast.ImportFrom) and node.module:
|
|
80
|
+
imported_modules.add(node.module)
|
|
81
|
+
elif isinstance(node, ast.ClassDef):
|
|
82
|
+
raise AssertionError(f"Unexpected runtime class '{node.name}' in auragrid_api")
|
|
83
|
+
|
|
84
|
+
forbidden = {"http", "http.server", "socket", "sqlite3", "httpx", "urllib", "asyncio", "subprocess"}
|
|
85
|
+
assert imported_modules.isdisjoint(forbidden), f"Forbidden runtime imports: {imported_modules & forbidden}"
|
|
86
|
+
assert list((SRC_DIR / "auragrid_api").glob("*.py")) == [init_file]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_schema_files_valid_and_mode_enum_unified() -> None:
|
|
90
|
+
"""Validate every JSON Schema and confirm MasMode enum lockdown."""
|
|
91
|
+
expected = {
|
|
92
|
+
"app.manifest.schema.json",
|
|
93
|
+
"service-descriptor.schema.json",
|
|
94
|
+
"catalog.schema.json",
|
|
95
|
+
"lease-collaboration.schema.json",
|
|
96
|
+
}
|
|
97
|
+
assert expected.issubset(set(auragrid_api.list_schemas()))
|
|
98
|
+
|
|
99
|
+
for name in expected:
|
|
100
|
+
schema_path = auragrid_api.get_schema_path(name)
|
|
101
|
+
assert schema_path.is_file()
|
|
102
|
+
schema = auragrid_api.load_schema(name)
|
|
103
|
+
Draft7Validator.check_schema(schema)
|
|
104
|
+
for ref in _collect_refs(schema):
|
|
105
|
+
_resolve_internal_pointer(schema, ref)
|
|
106
|
+
|
|
107
|
+
app_schema = auragrid_api.load_schema("app.manifest.schema.json")
|
|
108
|
+
assert app_schema["definitions"]["masMode"]["enum"] == [
|
|
109
|
+
"LocalOnly",
|
|
110
|
+
"CellSingleton",
|
|
111
|
+
"Distributed",
|
|
112
|
+
]
|
|
113
|
+
lease_schema = auragrid_api.load_schema("lease-collaboration.schema.json")
|
|
114
|
+
assert lease_schema["definitions"]["masMode"]["enum"] == [
|
|
115
|
+
"LocalOnly",
|
|
116
|
+
"CellSingleton",
|
|
117
|
+
"Distributed",
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_openapi_specs_have_zero_unresolved_refs() -> None:
|
|
122
|
+
"""Validate OpenAPI 3.1 specs exist, parse cleanly, and have 0 broken $refs."""
|
|
123
|
+
expected_specs = {
|
|
124
|
+
"ipc-bridge.openapi.json",
|
|
125
|
+
"aurasprout-management.openapi.json",
|
|
126
|
+
}
|
|
127
|
+
assert expected_specs.issubset(set(auragrid_api.list_openapi_specs()))
|
|
128
|
+
|
|
129
|
+
for spec_name in expected_specs:
|
|
130
|
+
spec_path = auragrid_api.get_openapi_path(spec_name)
|
|
131
|
+
assert spec_path.is_file()
|
|
132
|
+
spec = auragrid_api.load_openapi(spec_name)
|
|
133
|
+
assert spec["openapi"].startswith("3.1.")
|
|
134
|
+
assert spec["paths"]
|
|
135
|
+
assert spec["components"]["schemas"]
|
|
136
|
+
for ref in _collect_refs(spec):
|
|
137
|
+
_resolve_internal_pointer(spec, ref)
|
|
138
|
+
|
|
139
|
+
ipc_spec = auragrid_api.load_openapi("ipc-bridge.openapi.json")
|
|
140
|
+
for required_path in (
|
|
141
|
+
"/health",
|
|
142
|
+
"/api/health",
|
|
143
|
+
"/ready",
|
|
144
|
+
"/cell/config",
|
|
145
|
+
"/cell/governance/audit",
|
|
146
|
+
"/cell/events/topics",
|
|
147
|
+
"/cell/lease/acquire",
|
|
148
|
+
"/cell/collaboration/volunteer",
|
|
149
|
+
"/cell/collaboration/batches/claim",
|
|
150
|
+
"/cell/collaboration/conflicts",
|
|
151
|
+
"/cell/storage/read",
|
|
152
|
+
"/cell/storage/write",
|
|
153
|
+
"/cell/storage/append",
|
|
154
|
+
"/cell/storage/delete",
|
|
155
|
+
"/cell/storage/exists",
|
|
156
|
+
"/cell/registry/discover",
|
|
157
|
+
):
|
|
158
|
+
assert required_path in ipc_spec["paths"], f"Missing route {required_path} in ipc-bridge.openapi.json"
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def test_all_wire_vectors_match_schemas() -> None:
|
|
162
|
+
"""Named gate test verifying every golden JSON fixture validates against its schema."""
|
|
163
|
+
app_schema = auragrid_api.load_schema("app.manifest.schema.json")
|
|
164
|
+
Draft7Validator(app_schema, format_checker=FormatChecker()).validate(
|
|
165
|
+
auragrid_api.load_wire_vector("app_manifest.json")
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
descriptor_schema = auragrid_api.load_schema("service-descriptor.schema.json")
|
|
169
|
+
Draft7Validator(descriptor_schema, format_checker=FormatChecker()).validate(
|
|
170
|
+
auragrid_api.load_wire_vector("service_descriptor.json")
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
catalog_schema = auragrid_api.load_schema("catalog.schema.json")
|
|
174
|
+
Draft7Validator(catalog_schema, format_checker=FormatChecker()).validate(
|
|
175
|
+
auragrid_api.load_wire_vector("catalog_manifest.json")
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
lease_schema = auragrid_api.load_schema("lease-collaboration.schema.json")
|
|
179
|
+
lease_vectors = auragrid_api.load_wire_vector("lease_collaboration_vectors.json")
|
|
180
|
+
for def_name in (
|
|
181
|
+
"walMarker",
|
|
182
|
+
"leaseInfo",
|
|
183
|
+
"leaseRecordDto",
|
|
184
|
+
"leaseAcquisitionResult",
|
|
185
|
+
"workBatchClaimDto",
|
|
186
|
+
"leaseConflictDto",
|
|
187
|
+
):
|
|
188
|
+
assert def_name in lease_vectors
|
|
189
|
+
_validate_against_definition(lease_schema, def_name, lease_vectors[def_name], section="definitions")
|
|
190
|
+
|
|
191
|
+
ipc_spec = auragrid_api.load_openapi("ipc-bridge.openapi.json")
|
|
192
|
+
ipc_vectors = auragrid_api.load_wire_vector("ipc_bridge_vectors.json")
|
|
193
|
+
for schema_name, payload in ipc_vectors.items():
|
|
194
|
+
_validate_against_definition(ipc_spec, schema_name, payload, section="components/schemas")
|
|
195
|
+
|
|
196
|
+
mgmt_spec = auragrid_api.load_openapi("aurasprout-management.openapi.json")
|
|
197
|
+
mgmt_vectors = auragrid_api.load_wire_vector("management_vectors.json")
|
|
198
|
+
for schema_name, payload in mgmt_vectors.items():
|
|
199
|
+
_validate_against_definition(mgmt_spec, schema_name, payload, section="components/schemas")
|