graphql-engine/v3/crates
Daniel Harvey a95eaa4c4f Allow object types to be used as comparison operator arguments (#895)
<!-- The PR description should answer 2 (maybe 3) important questions:
-->

### What

This allows object types to be used as arguments for comparison
operators. This is useful for Elasticsearch's `range` operator, which
allows passing an object like `{ gt: 1, lt: 100 }` to an `integer` field
in order to filter items that are greater than `1` and less than `100`.

This PR has the nice side effect of dropping the requirement to use
information from scalar `BooleanExpressionType`s in place of
`DataConnectorScalarTypes`, which we only required because we were not
looking up the comparable operator information in scalar boolean
expression types correctly.

<!-- What is this PR trying to accomplish (and why, if it's not
obvious)? -->

<!-- Consider: do we need to add a changelog entry? -->

### How

Previously, when using `ObjectBooleanExpressionType` and
`DataConnectorScalarRepresentation`, we had no information about the
argument types of comparison operators (ie, what values should I pass to
`_eq`?), and so inferred this by looking up the comparison operator in
the data connector schema, then looking for a
`DataConnectorScalarRepresentation` that tells us what OpenDD type that
maps to.

Now, with `BooleanExpressionType`, we have this information provided in
OpenDD itself:

```yaml
kind: BooleanExpressionType
version: v1
definition:
  name: Int_comparison_exp
  operand:
    scalar:
      type: Int
      comparisonOperators:
        - name: _eq
          argumentType: Int! # This is an OpenDD type
        - name: _within
          argumentType: WithinInput!
        - name: _in
          argumentType: "[Int!]!"
```

Now we look up this information properly, as well as tightening up some
validation around relationships that was making us fall back to the old
way of doing things where the user had failed to provide a
`comparableRelationship` entry.

This means

a) we can actually use object types as comparable operator types
b) scalar boolean expression types aren't used outside the world of
boolean expressions, which is a lot easier to reason about.

<!-- How is it trying to accomplish it (what are the implementation
steps)? -->

V3_GIT_ORIGIN_REV_ID: ad5896c7f3dbf89a38e7a11ca9ae855a197211e3
2024-07-29 12:13:33 +00:00
..
auth introduce AuthConfig v2, which removes role emulation (#891) 2024-07-29 09:18:18 +00:00
custom-connector Make tests run over both the ndc v0.1.x and v0.2.x custom connectors (#879) 2024-07-25 13:32:01 +00:00
engine Allow object types to be used as comparison operator arguments (#895) 2024-07-29 12:13:33 +00:00
execute rename NdcFieldName to NdcFieldAlias (#882) 2024-07-26 08:10:15 +00:00
lang-graphql Explicitly import thiserror::Error in place (#827) 2024-07-11 15:18:27 +00:00
metadata-resolve Allow object types to be used as comparison operator arguments (#895) 2024-07-29 12:13:33 +00:00
metadata-schema-generator Move all dependency versions into the workspace file. (#734) 2024-06-20 12:25:55 +00:00
open-dds Validate that the capabilities version matches the DataConnectorLink schema version (#880) 2024-07-25 14:31:28 +00:00
plugins/pre-execution-plugin Explicitly import thiserror::Error in place (#827) 2024-07-11 15:18:27 +00:00
query-usage-analytics Reimplement most OpenDD newtypes using SmolStr and a macro (#797) 2024-07-05 10:16:33 +00:00
schema Move "test" job to Github Actions (#872) 2024-07-24 13:41:40 +00:00
sql rename NdcFieldName to NdcFieldAlias (#882) 2024-07-26 08:10:15 +00:00
utils Enable use of Otel baggage via tracing-util crate (#888) 2024-07-26 05:44:58 +00:00