rsm-schema 1.0.0__py3-none-any.whl
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.
- rsm_schema/__init__.py +35 -0
- rsm_schema/generated/__init__.py +54 -0
- rsm_schema/generated/models.py +1089 -0
- rsm_schema/inspector.py +318 -0
- rsm_schema/py.typed +0 -0
- rsm_schema/schema/rsm.schema.json +1519 -0
- rsm_schema-1.0.0.dist-info/METADATA +157 -0
- rsm_schema-1.0.0.dist-info/RECORD +10 -0
- rsm_schema-1.0.0.dist-info/WHEEL +4 -0
- rsm_schema-1.0.0.dist-info/licenses/LICENSE +202 -0
rsm_schema/__init__.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""RSM JSON Schema, generated Pydantic models, and inspection helpers."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from rsm_schema.generated import RSMMetadata
|
|
8
|
+
from rsm_schema.inspector import Schema, SchemaNode
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
__version__ = version("rsm-schema")
|
|
12
|
+
except PackageNotFoundError: # pragma: no cover - source tree without an install
|
|
13
|
+
__version__ = "0.0.0"
|
|
14
|
+
|
|
15
|
+
schema = Schema.bundled()
|
|
16
|
+
"""The bundled RSM JSON Schema, loaded once at import."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def validate_document(document: Mapping[str, Any]) -> None:
|
|
20
|
+
"""Validate a complete RSM document against the canonical JSON Schema.
|
|
21
|
+
|
|
22
|
+
This is the authoritative validation path when callers need conditional
|
|
23
|
+
JSON Schema rules that generated Pydantic models cannot express.
|
|
24
|
+
"""
|
|
25
|
+
schema.validate_document(document)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
"RSMMetadata",
|
|
30
|
+
"Schema",
|
|
31
|
+
"SchemaNode",
|
|
32
|
+
"__version__",
|
|
33
|
+
"schema",
|
|
34
|
+
"validate_document",
|
|
35
|
+
]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Pydantic v2 models generated from the bundled RSM JSON Schema.
|
|
2
|
+
|
|
3
|
+
``RSMMetadata`` is the document root. The other names re-exported here are the
|
|
4
|
+
reusable entities from the schema's ``$defs``; everything else the generator
|
|
5
|
+
emits (property wrappers, enums, and the ``Entry*`` value types) lives in
|
|
6
|
+
:mod:`rsm_schema.generated.models` under names the generator chooses, and is
|
|
7
|
+
not part of this package's public surface.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from rsm_schema.generated.models import (
|
|
11
|
+
Containerization,
|
|
12
|
+
Contributor,
|
|
13
|
+
DataFormat,
|
|
14
|
+
EdamTerm,
|
|
15
|
+
ExternalDependency,
|
|
16
|
+
ExternalService,
|
|
17
|
+
FunctionIo,
|
|
18
|
+
Funding,
|
|
19
|
+
Interface,
|
|
20
|
+
OperatingSystem,
|
|
21
|
+
Organization,
|
|
22
|
+
PersistentIdentifier,
|
|
23
|
+
Person,
|
|
24
|
+
ProgrammingLanguage,
|
|
25
|
+
Publication,
|
|
26
|
+
Registry,
|
|
27
|
+
RelatedSoftware,
|
|
28
|
+
RSMMetadata,
|
|
29
|
+
SoftwareFunction,
|
|
30
|
+
SupportRoute,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"Containerization",
|
|
35
|
+
"Contributor",
|
|
36
|
+
"DataFormat",
|
|
37
|
+
"EdamTerm",
|
|
38
|
+
"ExternalDependency",
|
|
39
|
+
"ExternalService",
|
|
40
|
+
"FunctionIo",
|
|
41
|
+
"Funding",
|
|
42
|
+
"Interface",
|
|
43
|
+
"OperatingSystem",
|
|
44
|
+
"Organization",
|
|
45
|
+
"PersistentIdentifier",
|
|
46
|
+
"Person",
|
|
47
|
+
"ProgrammingLanguage",
|
|
48
|
+
"Publication",
|
|
49
|
+
"RSMMetadata",
|
|
50
|
+
"Registry",
|
|
51
|
+
"RelatedSoftware",
|
|
52
|
+
"SoftwareFunction",
|
|
53
|
+
"SupportRoute",
|
|
54
|
+
]
|