Skip to content

Commit 24afd5d

Browse files
committed
docs: Wrap schema input configuration under a python property
Issue-246: #246
1 parent 6c16172 commit 24afd5d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/mkdocs_hooks.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Generate a JSON schema of the Python handler configuration."""
22

33
import json
4-
from dataclasses import fields
4+
from dataclasses import dataclass, fields
55
from os.path import join
66
from typing import Any
77

@@ -25,7 +25,12 @@ def on_post_build(config: MkDocsConfig, **kwargs: Any) -> None: # noqa: ARG001
2525
if TypeAdapter is None:
2626
logger.info("Pydantic is not installed, skipping JSON schema generation")
2727
return
28-
adapter = TypeAdapter(PythonInputConfig)
28+
29+
@dataclass
30+
class PythonHandlerSchema:
31+
python: PythonInputConfig
32+
33+
adapter = TypeAdapter(PythonHandlerSchema)
2934
schema = adapter.json_schema()
3035
schema["$schema"] = "https://json-schema.org/draft-07/schema"
3136
with open(join(config.site_dir, "schema.json"), "w") as file:

0 commit comments

Comments
 (0)