[feature] [xgrammar] support patternProperties/propertyNames/unevaluatedProperties kw for object types (#42904)

Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Co-authored-by: Artem Perevedentsev <aperevedents@nvidia.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
cjackal
2026-09-15 12:58:52 +08:00
committed by GitHub
co-authored by Artem Perevedentsev Claude Sonnet 5
parent 7b7e117c29
commit cd10ed6f9f
3 changed files with 172 additions and 16 deletions
@@ -137,7 +137,7 @@ def test_unsupported_grammar_is_a_client_error(backend, structured_outputs):
@pytest.mark.parametrize(
"schema, expected_backend",
[
# multipleOf is unsupported by xgrammar, patternProperties also by guidance.
# multipleOf is unsupported by xgrammar.
(
{
"type": "object",
@@ -145,8 +145,13 @@ def test_unsupported_grammar_is_a_client_error(backend, structured_outputs):
},
"guidance",
),
# patternProperties + properties is also unsupported by guidance.
(
{"type": "object", "patternProperties": {"^a": {"type": "string"}}},
{
"type": "object",
"properties": {"a": {"type": "string"}},
"patternProperties": {"^a$": {"type": "string"}},
},
"outlines",
),
],