pynydus.standards._loader¶
Spec file loader and shared validation helper.
Each spec file lives in specs/<name>.md and optionally contains a
JSON Schema block delimited by <!-- nydus:schema ... --> markers.
Module Contents¶
Functions¶
Load a spec markdown file and extract its embedded JSON Schema. |
|
Validate instance against a spec’s embedded JSON Schema. |
|
Extract the first |
Data¶
API¶
- pynydus.standards._loader._SPECS_DIR¶
None
- pynydus.standards._loader._SCHEMA_BLOCK_RE¶
‘compile(…)’
- pynydus.standards._loader.load_spec(name: str) tuple[str, dict[str, Any] | None]¶
Load a spec markdown file and extract its embedded JSON Schema.
Args: name: Standard name (e.g.
"mcp","agentskills","a2a"). Maps tospecs/<name>.md.Returns:
(full_markdown_text, json_schema_dict_or_None). The schema isNonewhen the spec has no embedded schema block (e.g.apm.md).Raises: FileNotFoundError: If the spec file does not exist. json.JSONDecodeError: If the schema block is not valid JSON.
- pynydus.standards._loader.validate_against_schema(instance: Any, spec_name: str, *, schema: dict[str, Any] | None = None, level: str = 'warning', label: str = '', location: str = '') list[pynydus.api.schemas.ValidationIssue]¶
Validate instance against a spec’s embedded JSON Schema.
Args: instance: JSON-compatible object to validate. spec_name: Standard name to load schema from (e.g.
"mcp"). schema: Override schema. IfNone, loads from the spec file. level: Issue level for findings ("warning"or"error"). label: Prefix for the issue message (e.g."MCP schema"). location: Base location string for the issue.Returns: List of :class:
ValidationIssue(empty when valid).