Add container smoke acceptance
This commit is contained in:
parent
d8dbf4950e
commit
61b31e4ebf
6 changed files with 109 additions and 7 deletions
|
|
@ -7,6 +7,7 @@ project's own draft contracts.
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
|
@ -14,11 +15,23 @@ from guide_board.errors import ValidationError
|
|||
from guide_board.io import load_json
|
||||
|
||||
|
||||
SCHEMA_DIR = Path(__file__).resolve().parents[2] / "docs" / "schemas"
|
||||
SOURCE_SCHEMA_DIR = Path(__file__).resolve().parents[2] / "docs" / "schemas"
|
||||
|
||||
|
||||
def load_schema(schema_name: str) -> dict[str, Any]:
|
||||
return load_json(SCHEMA_DIR / f"{schema_name}.schema.json")
|
||||
return load_json(_schema_dir() / f"{schema_name}.schema.json")
|
||||
|
||||
|
||||
def _schema_dir() -> Path:
|
||||
env_dir = os.environ.get("GUIDE_BOARD_SCHEMA_DIR")
|
||||
candidates = []
|
||||
if env_dir:
|
||||
candidates.append(Path(env_dir).expanduser())
|
||||
candidates.extend([SOURCE_SCHEMA_DIR, Path.cwd() / "docs" / "schemas"])
|
||||
for candidate in candidates:
|
||||
if (candidate / "target-profile.schema.json").is_file():
|
||||
return candidate
|
||||
return candidates[0]
|
||||
|
||||
|
||||
def validate_document(document: Any, schema: dict[str, Any], path: str = "$") -> list[str]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue