Unverified Commit 06089365 authored by Johannes F's avatar Johannes F Committed by GitHub
Browse files
parent e9add129
......@@ -76,6 +76,8 @@ def sample_json_schema():
},
"required": ["name", "age", "skills", "grade", "email", "work_history"],
"additionalProperties": False,
"minProperties": 1,
"maxProperties": 10,
}
......@@ -96,6 +98,9 @@ def unsupported_json_schema():
},
"required": ["score", "tags"],
"additionalProperties": False,
"patternProperties": {
"^score$": {"type": "integer"},
},
}
......
......@@ -44,8 +44,6 @@ def unsupported_array_schemas():
@pytest.fixture
def unsupported_object_schemas():
return [
{"type": "object", "minProperties": 1},
{"type": "object", "maxProperties": 5},
{"type": "object", "propertyNames": {"pattern": "^[a-z]+$"}},
{"type": "object", "patternProperties": {"^S": {"type": "string"}}},
]
......@@ -79,6 +77,8 @@ def supported_schema():
},
},
},
"minProperties": 1,
"maxProperties": 100,
}
......
......@@ -268,13 +268,7 @@ def has_xgrammar_unsupported_json_features(schema: dict[str, Any]) -> bool:
# Unsupported keywords for objects
if obj.get("type") == "object" and any(
key in obj
for key in (
"minProperties",
"maxProperties",
"propertyNames",
"patternProperties",
)
key in obj for key in ("patternProperties", "propertyNames")
):
return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment