← back to karstenskyt__osti

Function bodies 3 total

All specs Real LLM only Function bodies
generate_json_schema function · python · L23-L38 (16 LOC)
scripts/generate.py
def generate_json_schema() -> Path:
    """Export Pydantic JSON Schema to generated/osti.schema.json."""
    GENERATED.mkdir(exist_ok=True)

    schema = SessionPlan.model_json_schema()
    schema["$id"] = f"https://karstenskyt.github.io/osti/v{SCHEMA_VERSION}/schema.json"
    schema["title"] = "OSTI SessionPlan"
    schema["description"] = (
        f"Open Standard for Training Interoperability v{SCHEMA_VERSION} — "
        "FHIR-inspired schema for soccer/football session plans."
    )

    out = GENERATED / "osti.schema.json"
    out.write_text(json.dumps(schema, indent=2) + "\n", encoding="utf-8")
    print(f"  JSON Schema -> {out}")
    return out
generate_linkml_yaml function · python · L41-L60 (20 LOC)
scripts/generate.py
def generate_linkml_yaml(json_schema_path: Path) -> Path | None:
    """Convert JSON Schema to LinkML YAML using schema-automator (optional)."""
    out = GENERATED / "osti.linkml.yaml"
    try:
        subprocess.run(
            [
                sys.executable, "-m", "schema_automator.importers.json_schema_import",
                str(json_schema_path),
                "-o", str(out),
            ],
            check=True,
            capture_output=True,
            text=True,
        )
        print(f"  LinkML YAML -> {out}")
        return out
    except (subprocess.CalledProcessError, FileNotFoundError) as exc:
        print(f"  LinkML YAML -- skipped ({exc.__class__.__name__})")
        print("  Install with: pip install osti[dev]")
        return None
main function · python · L63-L68 (6 LOC)
scripts/generate.py
def main() -> None:
    print(f"OSTI v{SCHEMA_VERSION} -- Artifact Generation")
    print("=" * 50)
    json_schema = generate_json_schema()
    generate_linkml_yaml(json_schema)
    print("Done.")