-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
- Performance issue: O(n²) strategy deduplication in _MetaSchemaBuilder
Location: genson/schema/builder.py url:https://github.com/wolverdude/GenSON/blob/master/genson/schema/builder.py
Current behavior:
schema strategies are deduplicated using a list with repeated membership checks,
This results in O(n²) time complexityunique_schema_strategies = [] for schema_strategy in schema_strategies: if schema_strategy not in unique_schema_strategies: unique_schema_strategies.append(schema_strategy)
2.Bug: Empty tuple schemas produce an unexpected schema item
Location: genson/schema/strategies/array.py url:https://github.com/wolverdude/GenSON/blob/master/genson/schema/strategies/array.py
Steps to reproduce
from genson import SchemaBuilder
builder = SchemaBuilder()
builder.add_schema({'type': 'array', 'items': []})
schema = builder.to_schema()
current output:{'type': 'array', 'items': [{}]} Expected output:{'type': 'array', 'items': []}
The Tuple strategy initializes its internal _items list with a single empty schema instance, even when the tuple definition is explicitly empty.
Metadata
Metadata
Assignees
Labels
No labels