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": { "condition": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -300,7 +303,7 @@
} }
}, },
"type": [ "type": [
"object", "filter",
"null" "null"
] ]
}, },
@ -341,11 +344,11 @@
] ]
} }
}, },
"type": "object" "type": "filter"
}, },
"address": {}, "address": {},
"address.filter": { "address.filter": {
"type": "object", "type": "filter",
"compiledPropertyNames": [ "compiledPropertyNames": [
"$and", "$and",
"$or", "$or",
@ -389,12 +392,13 @@
} }
}, },
"condition": {}, "condition": {},
"filter": {},
"string.condition": {}, "string.condition": {},
"integer.condition": {}, "integer.condition": {},
"date.condition": {}, "date.condition": {},
"search": {}, "search": {},
"search.filter": { "search.filter": {
"type": "object", "type": "filter",
"compiledPropertyNames": [ "compiledPropertyNames": [
"$and", "$and",
"$or", "$or",

View File

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

View File

@ -34,7 +34,7 @@ impl Schema {
if let Some(mut inline_schema) = structural_filter { if let Some(mut inline_schema) = structural_filter {
inline_schema.obj.type_ = Some(SchemaTypeOrArray::Multiple(vec![ inline_schema.obj.type_ = Some(SchemaTypeOrArray::Multiple(vec![
"object".to_string(), "filter".to_string(),
"null".to_string(), "null".to_string(),
])); ]));
@ -104,8 +104,8 @@ impl Schema {
} }
let mut wrapper_obj = SchemaObject::default(); let mut wrapper_obj = SchemaObject::default();
// Filters are just plain objects containing conditions, no inheritance required // Filters now inherit from the base 'filter' type
wrapper_obj.type_ = Some(SchemaTypeOrArray::Single("object".to_string())); wrapper_obj.type_ = Some(SchemaTypeOrArray::Single("filter".to_string()));
wrapper_obj.properties = Some(filter_props); wrapper_obj.properties = Some(filter_props);
return Some(Schema { return Some(Schema {

View File

@ -461,10 +461,24 @@ impl<'a> Compiler<'a> {
.cloned() .cloned()
.unwrap_or_else(|| format!("{}_t_err", node.parent_alias)); .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 { if let Some(gf) = grouped_fields {
for (t_name, fields_val) in gf { for (t_name, fields_val) in gf {
if let Some(fields_arr) = fields_val.as_array() { 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 owner_alias = table_aliases
.get(t_name) .get(t_name)
.cloned() .cloned()

View File

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