diff --git a/fixtures/filter.json b/fixtures/filter.json index 965a143..5ba6d87 100644 --- a/fixtures/filter.json +++ b/fixtures/filter.json @@ -138,6 +138,9 @@ } } }, + "filter": { + "type": "object" + }, "condition": { "type": "object", "properties": { @@ -300,7 +303,7 @@ } }, "type": [ - "object", + "filter", "null" ] }, @@ -341,11 +344,11 @@ ] } }, - "type": "object" + "type": "filter" }, "address": {}, "address.filter": { - "type": "object", + "type": "filter", "compiledPropertyNames": [ "$and", "$or", @@ -389,12 +392,13 @@ } }, "condition": {}, + "filter": {}, "string.condition": {}, "integer.condition": {}, "date.condition": {}, "search": {}, "search.filter": { - "type": "object", + "type": "filter", "compiledPropertyNames": [ "$and", "$or", diff --git a/src/database/compile/filter.rs b/src/database/compile/filter.rs index c9ea3f5..700e128 100644 --- a/src/database/compile/filter.rs +++ b/src/database/compile/filter.rs @@ -34,7 +34,7 @@ impl Schema { if let Some(mut inline_schema) = structural_filter { inline_schema.obj.type_ = Some(SchemaTypeOrArray::Multiple(vec![ - "object".to_string(), + "filter".to_string(), "null".to_string(), ])); @@ -104,8 +104,8 @@ impl Schema { } let mut wrapper_obj = SchemaObject::default(); - // Filters are just plain objects containing conditions, no inheritance required - wrapper_obj.type_ = Some(SchemaTypeOrArray::Single("object".to_string())); + // Filters now inherit from the base 'filter' type + wrapper_obj.type_ = Some(SchemaTypeOrArray::Single("filter".to_string())); wrapper_obj.properties = Some(filter_props); return Some(Schema {