feat(ontology): 本体 spec 与跨引用校验

- pydantic 模型覆盖 entities/links/actions/functions/rules/constraints
- 跨引用校验:link.from/to 实体存在、rule.via 链路连得通且终点与 to 一致
- YAML 1.2 口径 loader:on/off/yes/no 不再被当成布尔(否则 on: Line 解析成 {True: Line})
- of 支持标量类型或实体名;属性支持 accepted: boolean 简写
- 19 条测试,其中 test_readme_example_loads 直接解析 README 里的 YAML
- dev 组补 types-pyyaml,mypy strict 通过
This commit is contained in:
Donny committed 2026-11-05 02:36:25 +08:00
1 parent e0bea0c54f
commit cc0d80ba3a
4 files changed
+598

No files matched your search

Generated
+11
View File
@@ -31,6 +31,7 @@ dev = [
{ name = "pytest-asyncio" },
{ name = "ruff" },
{ name = "testcontainers" },
{ name = "types-pyyaml" },
]
[package.metadata]
@@ -51,6 +52,7 @@ dev = [
{ name = "pytest-asyncio", specifier = ">=0.24" },
{ name = "ruff", specifier = ">=0.8" },
{ name = "testcontainers", extras = ["postgres"], specifier = ">=4.8" },
{ name = "types-pyyaml", specifier = ">=6.0.12" },
]
[[package]]
@@ -1225,6 +1227,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/00/7e/424aac8b355597835deb333e757a0e94b5ccf38ad00f07fe6ed1f4e17c88/testcontainers-4.15.0-py3-none-any.whl", hash = "sha256:8796c14e76604031ad39cf0ed3b8e9806283a1fbf5270965c2b1c594caa31b74", size = 160771, upload-time = "2026-07-24T23:08:00.13Z" },
]
[[package]]
name = "types-pyyaml"
version = "6.0.12.20261103"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/d9/82/2ed4d215a2840b467a9a864f03b0d21904250e28f5e1f006ad36fba0311a/types_pyyaml-6.0.12.20261103.tar.gz", hash = "sha256:7a1b5f837881dd35d5448b5f18275164f89f206185e31e8eae6e0b42607bc001", size = 18911, upload-time = "2026-11-03T08:45:23.714Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e8/10/4353eb86278f6a59aeb9fe2be4d979c20b110b4009fa455a3ea6467cf5cb/types_pyyaml-6.0.12.20261103-py3-none-any.whl", hash = "sha256:444654c61f635dab82c092a511aa96a0ce31164810784b9a37314e3e56532ac8", size = 21299, upload-time = "2026-11-03T08:45:22.749Z" },
]
[[package]]
name = "typing-extensions"
version = "4.16.0"