Fix: json_schema_to_gbnf should take string dump of json schema as input

This commit is contained in:
Andrei Betlen 2023-11-10 02:50:17 -05:00
parent e7962d2c73
commit faeae181b1

View file

@ -1484,7 +1484,7 @@ class SchemaConverter:
def json_schema_to_gbnf(schema: str, prop_order: Optional[List[str]] = None):
prop_order = prop_order or []
schema = json.load(schema)
schema = json.loads(schema)
prop_order = {name: idx for idx, name in enumerate(prop_order)}
converter = SchemaConverter(prop_order)
converter.visit(schema, "")