Skip to content

Commit 100b686

Browse files
committed
Use a proxy type for JSON schema
1 parent 3b9c36a commit 100b686

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/scikit_build_core/resources/scikit-build.schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
},
3838
{
3939
"type": "boolean"
40+
},
41+
{
42+
"type": "array",
43+
"items": {
44+
"type": "string"
45+
}
4046
}
4147
]
4248
},
@@ -58,6 +64,12 @@
5864
},
5965
{
6066
"type": "boolean"
67+
},
68+
{
69+
"type": "array",
70+
"items": {
71+
"type": "string"
72+
}
6173
}
6274
]
6375
}

src/scikit_build_core/settings/json_schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def convert_type(t: Any, *, normalize_keys: bool) -> dict[str, Any]:
151151
}
152152
if origin is Literal:
153153
return {"enum": list(args)}
154+
if hasattr(t, "json_schema"):
155+
return convert_type(t.json_schema, normalize_keys=normalize_keys)
154156

155157
msg = f"Cannot convert type {t} to JSON Schema"
156158
raise FailedConversionError(msg)

src/scikit_build_core/settings/skbuild_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def __dir__() -> List[str]:
2828

2929

3030
class CMakeSettingsDefine(str):
31+
json_schema = Union[str, bool, List[str]]
32+
3133
def __new__(cls, raw: Union[str, bool, List[str]]) -> "CMakeSettingsDefine":
3234
def escape_semicolons(item: str) -> str:
3335
return item.replace(";", r"\;")

0 commit comments

Comments
 (0)