Update json-schema-to-grammar.py
This commit is contained in:
parent
259f3505bc
commit
b061de52a7
1 changed files with 3 additions and 3 deletions
|
@ -208,7 +208,7 @@ class SchemaConverter:
|
||||||
properties = schema['properties']
|
properties = schema['properties']
|
||||||
return self._add_rule(rule_name, self._build_object_rule(properties.items(), required, name))
|
return self._add_rule(rule_name, self._build_object_rule(properties.items(), required, name))
|
||||||
|
|
||||||
elif schema_type == 'object' and 'allOf' in schema:
|
elif schema_type in (None, 'object') and 'allOf' in schema:
|
||||||
required = set()
|
required = set()
|
||||||
properties = []
|
properties = []
|
||||||
def add_component(comp_schema, is_required):
|
def add_component(comp_schema, is_required):
|
||||||
|
@ -228,7 +228,7 @@ class SchemaConverter:
|
||||||
|
|
||||||
return self._add_rule(rule_name, self._build_object_rule(properties, required, name))
|
return self._add_rule(rule_name, self._build_object_rule(properties, required, name))
|
||||||
|
|
||||||
elif schema_type == 'object' and 'additionalProperties' in schema:
|
elif schema_type in (None, 'object') and 'additionalProperties' in schema:
|
||||||
additional_properties = schema['additionalProperties']
|
additional_properties = schema['additionalProperties']
|
||||||
if not isinstance(additional_properties, dict):
|
if not isinstance(additional_properties, dict):
|
||||||
additional_properties = {}
|
additional_properties = {}
|
||||||
|
@ -240,7 +240,7 @@ class SchemaConverter:
|
||||||
rule_name,
|
rule_name,
|
||||||
f'( {kv_rule} ( "," space {kv_rule} )* )*')
|
f'( {kv_rule} ( "," space {kv_rule} )* )*')
|
||||||
|
|
||||||
elif schema_type == 'array' and 'items' in schema:
|
elif schema_type in (None, 'array') and 'items' in schema:
|
||||||
# TODO `prefixItems` keyword
|
# TODO `prefixItems` keyword
|
||||||
items = schema['items']
|
items = schema['items']
|
||||||
if isinstance(items, list):
|
if isinstance(items, list):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue