Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8cc4cbde8 | |||
| 5af2399e3b |
@ -175,6 +175,7 @@ In the Punc architecture, filters are automatically synthesized, strongly-typed
|
||||
|
||||
* **Conditions**: A condition schema is the contract defining the mathematical operations allowed on a primitive field. For example, a `string.condition` allows `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$of` (IN), and `$nof` (NOT IN).
|
||||
* **Enum Conditions**: When JSPG synthesizes an enum, it dynamically generates an `<enum>.condition` (e.g., `address_kind.condition`). This strongly-typed condition perfectly mirrors the operations of a `string.condition`, but strictly limits the arrays and inputs of `$eq`, `$ne`, `$of`, and `$nof` to the exact variations defined by that Enum. This context ensures that UI generators know exactly when to render `<Select>` dropdowns instead of generic `<Text>` boxes.
|
||||
* **Pre-compiled Condition and Filter Mapping**: To prevent redundant double-wrapping of search structures, any schema property whose type is already a `.condition` or `.filter` type (such as `"string.condition"` or `"$kind.filter"`) maps directly to itself during filter synthesis rather than receiving a redundant `.filter` suffix.
|
||||
* **Filters**: A filter schema (e.g., `person.filter`) is an object containing condition properties used to filter entities. It natively supports structural composition:
|
||||
* **Inherited Properties**: Filters automatically inherit all valid database columns from their base type schema, immediately converting them to their respective `.condition` schemas.
|
||||
* **Relational Proxies**: If a table has a foreign key to another table, the filter automatically generates a proxy property pointing to the related entity's filter (e.g., the `person` filter automatically gains an `organization` property that points to `organization.filter`), allowing infinitely deep nested queries natively.
|
||||
|
||||
@ -466,7 +466,7 @@
|
||||
},
|
||||
"filter": {
|
||||
"type": [
|
||||
"$kind.filter.filter",
|
||||
"$kind.filter",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
|
||||
@ -159,7 +159,9 @@ impl Schema {
|
||||
},
|
||||
"null" => None,
|
||||
custom => {
|
||||
if db.enums.contains_key(custom) {
|
||||
if custom.ends_with(".condition") || custom.ends_with(".filter") {
|
||||
Some(vec![custom.to_string()])
|
||||
} else if db.enums.contains_key(custom) {
|
||||
Some(vec![format!("{}.condition", custom)])
|
||||
} else {
|
||||
// Assume anything else is a Relational cross-boundary that already has its own .filter dynamically built
|
||||
|
||||
Reference in New Issue
Block a user