-
Notifications
You must be signed in to change notification settings - Fork 2
Support more operators for the on condition #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1080,10 +1080,10 @@ definitions: | |||||
|
|
||||||
| The `on` condition is constructed by triples of: | ||||||
| - Reference to the target element (ID) as array with 2 items | ||||||
| - Equals Operator "=" | ||||||
| - Equals Operator `=` or Smaller Equals Operator `<=` or Bigger Equals Operator `>=` | ||||||
| - Reference to the local element (ID) as array with 1 item OR a constant value (`val`) | ||||||
|
|
||||||
| The first and third entry MAY be reversed but the `=` operator MUST be in the middle. | ||||||
| The first and third entry MAY be reversed but the `=`, `<=` or `>=` operator MUST be in the middle. | ||||||
| The target element reference MUST have two array items. The first item is the association name and the second item is the target element name. | ||||||
| The local element reference MUST have one array item, which is the local element name. | ||||||
|
|
||||||
|
|
@@ -1095,11 +1095,15 @@ definitions: | |||||
| oneOf: | ||||||
| - $ref: "#/definitions/StructuredElementReference" | ||||||
| - $ref: "#/definitions/EqualsOperator" | ||||||
| - $ref: "#/definitions/SmallerEqualsOperator" | ||||||
| - $ref: "#/definitions/BiggerEqualsOperator" | ||||||
| - $ref: "#/definitions/AndOperator" | ||||||
| - $ref: "#/definitions/OnValue" | ||||||
| minItems: 3 | ||||||
| examples: | ||||||
| - [{ "ref": ["to_Connection", "AirlineID"] }, "=", { "ref": ["AirlineID"] }] | ||||||
| - [{ "ref": ["to_Connection", "FlightDate"] }, "<=", { "ref": ["FlightDate"] }] | ||||||
| - [{ "ref": ["to_Connection", "FlightDate"] }, ">=", { "ref": ["FlightDate"] }] | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some questions from my side, to be discussed:
Example, "<=" and "<=" operators :
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @Fannon , CAP doesn't apply any restrictions on the ON condition. Any kind of condition (all operators, all types) are allowed. Accordingly, we don't have any such checks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if an operator is not known / supported by CAP or another consumer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CAP doesn't care. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But wouldn't this on condition need to be resolved, in the case of an association even as a foreign key? Maybe the example added here is a bit confusing. An "on" condition of an association or composition probably always need to return exactly one match? Its a different use case compared to a view where we want to query / select multiple results. Here comparator operations like |
||||||
| - [ | ||||||
| { "ref": ["to_Connection", "AirlineID"] }, | ||||||
| "=", | ||||||
|
|
@@ -1426,14 +1430,28 @@ definitions: | |||||
| title: Equals Operator | ||||||
| type: string | ||||||
| description: |- | ||||||
| The operator "=" | ||||||
| The operator `=` | ||||||
| const: "=" | ||||||
|
|
||||||
| SmallerEqualsOperator: | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we use smaller or bigger equals operators, the cardinality of the "on" condition has to be "to many". We need to define for which data types a comparator like this is valid and how comparison works. So far we seem to only need it for date (time dependent references / queries) |
||||||
| title: Smaller Equals Operator | ||||||
| type: string | ||||||
| description: |- | ||||||
| The operator `<=` | ||||||
| const: "<=" | ||||||
|
|
||||||
| BiggerEqualsOperator: | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| title: Bigger Equals Operator | ||||||
| type: string | ||||||
| description: |- | ||||||
| The operator `>=` | ||||||
| const: ">=" | ||||||
|
|
||||||
| AndOperator: | ||||||
| title: AND Operator | ||||||
| type: string | ||||||
| description: |- | ||||||
| The operator "and" | ||||||
| The operator `and` | ||||||
| const: "and" | ||||||
|
|
||||||
| OnValue: | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.