Compare commits

...

5 Commits

Author SHA1 Message Date
ba5079fb73 version: 1.0.134 2026-04-28 15:07:11 -04:00
98e7f5da12 fixed oneOf case queryer issue with resolving the table alias 2026-04-28 15:07:01 -04:00
9599b4cbc3 version: 1.0.133 2026-04-24 12:55:33 -04:00
f51799f0b1 fixed failing lib test 2026-04-24 12:55:25 -04:00
c8757e1709 added filter base type 2026-04-24 12:53:28 -04:00
7 changed files with 65 additions and 20 deletions

View File

@ -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",

View File

@ -1320,7 +1320,7 @@
" 'id', entity_11.id,",
" 'is_primary', contact_9.is_primary,",
" 'target', CASE",
" WHEN entity_11.target_type = 'address' THEN",
" WHEN relationship_10.target_type = 'address' THEN",
" ((SELECT jsonb_build_object(",
" 'archived', entity_13.archived,",
" 'city', address_12.city,",
@ -1333,7 +1333,7 @@
" WHERE",
" NOT entity_13.archived",
" AND relationship_10.target_id = entity_13.id))",
" WHEN entity_11.target_type = 'email_address' THEN",
" WHEN relationship_10.target_type = 'email_address' THEN",
" ((SELECT jsonb_build_object(",
" 'address', email_address_14.address,",
" 'archived', entity_15.archived,",
@ -1346,7 +1346,7 @@
" WHERE",
" NOT entity_15.archived",
" AND relationship_10.target_id = entity_15.id))",
" WHEN entity_11.target_type = 'phone_number' THEN",
" WHEN relationship_10.target_type = 'phone_number' THEN",
" ((SELECT jsonb_build_object(",
" 'archived', entity_17.archived,",
" 'created_at', entity_17.created_at,",
@ -1556,7 +1556,7 @@
" 'id', entity_11.id,",
" 'is_primary', contact_9.is_primary,",
" 'target', CASE",
" WHEN entity_11.target_type = 'address' THEN",
" WHEN relationship_10.target_type = 'address' THEN",
" ((SELECT jsonb_build_object(",
" 'archived', entity_13.archived,",
" 'city', address_12.city,",
@ -1569,7 +1569,7 @@
" WHERE",
" NOT entity_13.archived",
" AND relationship_10.target_id = entity_13.id))",
" WHEN entity_11.target_type = 'email_address' THEN",
" WHEN relationship_10.target_type = 'email_address' THEN",
" ((SELECT jsonb_build_object(",
" 'address', email_address_14.address,",
" 'archived', entity_15.archived,",
@ -1582,7 +1582,7 @@
" WHERE",
" NOT entity_15.archived",
" AND relationship_10.target_id = entity_15.id))",
" WHEN entity_11.target_type = 'phone_number' THEN",
" WHEN relationship_10.target_type = 'phone_number' THEN",
" ((SELECT jsonb_build_object(",
" 'archived', entity_17.archived,",
" 'created_at', entity_17.created_at,",
@ -1989,7 +1989,7 @@
" 'is_primary', contact_11.is_primary,",
" 'target',",
" CASE",
" WHEN entity_13.target_type = 'address' THEN (",
" WHEN relationship_12.target_type = 'address' THEN (",
" (SELECT jsonb_build_object(",
" 'archived', entity_15.archived,",
" 'city', address_14.city,",
@ -2003,7 +2003,7 @@
" NOT entity_15.archived",
" AND relationship_12.target_id = entity_15.id)",
" )",
" WHEN entity_13.target_type = 'email_address' THEN (",
" WHEN relationship_12.target_type = 'email_address' THEN (",
" (SELECT jsonb_build_object(",
" 'address', email_address_16.address,",
" 'archived', entity_17.archived,",
@ -2017,7 +2017,7 @@
" NOT entity_17.archived",
" AND relationship_12.target_id = entity_17.id)",
" )",
" WHEN entity_13.target_type = 'phone_number' THEN (",
" WHEN relationship_12.target_type = 'phone_number' THEN (",
" (SELECT jsonb_build_object(",
" 'archived', entity_19.archived,",
" 'created_at', entity_19.created_at,",

View File

@ -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 {

View File

@ -461,10 +461,24 @@ impl<'a> Compiler<'a> {
.cloned()
.unwrap_or_else(|| format!("{}_t_err", node.parent_alias));
let mut lookup_key = prop_key.as_str();
if let Some(edges) = node.schema.obj.compiled_edges.get() {
if let Some(edge) = edges.get(prop_key) {
if let Some(relation) = self.db.relations.get(&edge.constraint) {
if edge.forward {
lookup_key = &relation.source_columns[0];
} else {
lookup_key = &relation.destination_columns[0];
}
}
}
}
if let Some(gf) = grouped_fields {
for (t_name, fields_val) in gf {
if let Some(fields_arr) = fields_val.as_array() {
if fields_arr.iter().any(|v| v.as_str() == Some(prop_key)) {
if fields_arr.iter().any(|v| v.as_str() == Some(lookup_key)) {
owner_alias = table_aliases
.get(t_name)
.cloned()

View File

@ -160,7 +160,7 @@ fn test_library_api() {
"target": { "type": ["target_schema.filter", "null"] },
"type": { "type": ["string.condition", "null"] }
},
"type": "object"
"type": "filter"
}
},
"sensitive": false,
@ -211,7 +211,7 @@ fn test_library_api() {
},
"value": { "type": ["number.condition", "null"] }
},
"type": "object"
"type": "filter"
}
},
"sensitive": false,

27
test_out.txt Normal file

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
1.0.132
1.0.134