Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
docs(generate-schemas): create dir before write
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinNitroG committed Jan 12, 2025
1 parent f0c4f12 commit d7b97dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build-web: restore-env
mkdir ./site/schemas/ -p
uv run generate-schemas --frozen
cp ./schemas/* ./site/schemas
uv run generate-schema-doc --config-file jsfh-conf.yaml ./site/schemas/
uv run generate-schema-doc --config-file jsfh-conf.yaml ./site/schemas/ ./site/schemas/

clean: restore-env
uvx cleanpy@0.5.1 .
Expand Down
3 changes: 3 additions & 0 deletions src/generate_schemas/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from json import dumps
from os import makedirs
from os.path import dirname

from pydantic import TypeAdapter

Expand All @@ -9,6 +11,7 @@

def generate_config_schema():
print("Generating config schema...")
makedirs(dirname(CONFIG_SCHEMA_PATH), exist_ok=True)
adapter: TypeAdapter[Config] = TypeAdapter(Config)
with open(CONFIG_SCHEMA_PATH, "w", encoding="utf8") as file:
file.write(dumps(adapter.json_schema(), indent=2, ensure_ascii=False))
Expand Down

0 comments on commit d7b97dd

Please sign in to comment.