Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import json
import sys
from pathlib import Path
from shutil import which
Expand Down Expand Up @@ -266,3 +267,17 @@ def generate_python_sdk(context: Context) -> None: # noqa: ARG001
"""Generate documentation for the Python SDK."""
_generate_infrahub_sdk_configuration_documentation()
_generate_infrahub_sdk_template_documentation()


@task
def generate_repository_jsonschema(context: Context) -> None:
"""Generate JSON schema file for repository configuration. https://github.com/opsmill/infrahub-jsonschema"""
from infrahub_sdk.schema.repository import InfrahubRepositoryConfig

repository_jsonschema = MAIN_DIRECTORY_PATH / "generated" / "repository-config" / "develop.json"

with context.cd(MAIN_DIRECTORY_PATH):
schema = json.dumps(InfrahubRepositoryConfig.model_json_schema(), indent=4)
repository_jsonschema.parent.mkdir(parents=True, exist_ok=True)
repository_jsonschema.write_text(schema)
print(f"Wrote to {repository_jsonschema}")