-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
GraphQL Object constraints #5715
Conversation
Implements the GraphQL Object constraints, which allows us to filter queries results using the `$eq`, `$lt`, `$gt`, `$in`, and other Parse supported constraints. Example: ``` query objects { findMyClass(where: { objField: { _eq: { key: 'foo.bar', value: 'hello' }, _gt: { key: 'foo.number', value: 10 }, _lt: { key: 'anotherNumber', value: 5 } } }) { results { objectId } } } ``` In the example above, we have the `findMyClass` query (automatically generated for the `MyClass` class), and a field named `objField` whose type is Object. The object below represents a valid `objField` value and would satisfy all constraints: ``` { "foo": { "bar": "hello", "number": 11 }, "anotherNumber": 4 } ``` The Object constraint is applied only when using Parse class object type queries. When using "generic" queries such as `get` and `find`, this type of constraint is not available.
It seems not working properly for Postgres. Can you please take a look? |
Fixes the $eq, $ne, $gt, and $lt constraints when applied on an Object type field.
Codecov Report
@@ Coverage Diff @@
## master #5715 +/- ##
=========================================
- Coverage 93.72% 93.7% -0.02%
=========================================
Files 153 153
Lines 10703 10724 +21
=========================================
+ Hits 10031 10049 +18
- Misses 672 675 +3
Continue to review full report at Codecov.
|
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.
Send some changes/questions that I think may be required. I also saw some changes in the Postgres adapter. I am little bit afraid of them because I think we don't have good coverage for Postgres with current tests. What do you think? Do you think that the current tests cover the changes you did? Or would it be better to create some additional tests?
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.
LGTM!
* GraphQL Object constraints Implements the GraphQL Object constraints, which allows us to filter queries results using the `$eq`, `$lt`, `$gt`, `$in`, and other Parse supported constraints. Example: ``` query objects { findMyClass(where: { objField: { _eq: { key: 'foo.bar', value: 'hello' }, _gt: { key: 'foo.number', value: 10 }, _lt: { key: 'anotherNumber', value: 5 } } }) { results { objectId } } } ``` In the example above, we have the `findMyClass` query (automatically generated for the `MyClass` class), and a field named `objField` whose type is Object. The object below represents a valid `objField` value and would satisfy all constraints: ``` { "foo": { "bar": "hello", "number": 11 }, "anotherNumber": 4 } ``` The Object constraint is applied only when using Parse class object type queries. When using "generic" queries such as `get` and `find`, this type of constraint is not available. * Objects constraints not working on Postgres Fixes the $eq, $ne, $gt, and $lt constraints when applied on an Object type field. * Fix object constraint field name * Fix Postgres constraints indexes * fix: Object type composed constraints not working * fix: Rename key and value fields * refactor: Object constraints for generic queries * fix: Object constraints not working on Postgres
Implements the GraphQL Object constraints, which allows us to filter queries results using the
$eq
,$lt
,$gt
,$in
, and other Parse supported constraints.Example:
In the example above, we have a Parse class named
MyClass
, and a field namedobjField
whose type is Object. The object below represents a validobjField
and would satisfy all constraints:The Object constraint is applied only when using Parse class object type queries. When using "generic" queries such as
get
andfind
, this type of constraint is not available.