feat: add project adapter shadow contract
This commit is contained in:
parent
411f417670
commit
561d98f1f8
10 changed files with 532 additions and 21 deletions
|
|
@ -11,7 +11,14 @@ from dataclasses import replace
|
|||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from .config_validation import ID_PATTERN, confined_path, positive_int, require_string, string_list
|
||||
from .config_validation import (
|
||||
AUTHORITIES,
|
||||
ID_PATTERN,
|
||||
confined_path,
|
||||
positive_int,
|
||||
require_string,
|
||||
string_list,
|
||||
)
|
||||
from .errors import DocForgeError
|
||||
from .models import (
|
||||
ContextProfile,
|
||||
|
|
@ -24,7 +31,6 @@ from .models import (
|
|||
)
|
||||
from .render_config import load_render_config
|
||||
|
||||
_AUTHORITIES = frozenset({"authoritative", "approved_plan", "derived", "proposal", "historical"})
|
||||
_CORE_METADATA = frozenset(
|
||||
{
|
||||
"schema_version",
|
||||
|
|
@ -363,7 +369,7 @@ def validated_node_from_record(
|
|||
if ID_PATTERN.fullmatch(node_id) is None:
|
||||
raise DocForgeError("invalid_source", f"{source.name}: node ID is invalid", id=node_id)
|
||||
authority = require_string(record, "authority", source)
|
||||
if authority not in _AUTHORITIES:
|
||||
if authority not in AUTHORITIES:
|
||||
raise DocForgeError(
|
||||
"invalid_source", f"{source.name}: authority is invalid", authority=authority
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue