-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graphql): Allow specifying fields that are required when querying
- Loading branch information
1 parent
7426501
commit a425ba7
Showing
13 changed files
with
406 additions
and
17 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
packages/query-graphql/__tests__/__fixtures__/cursor-query-args-required-filter-type.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
type Query { | ||
test( | ||
"""Limit or page results.""" | ||
paging: CursorPaging = {first: 10} | ||
|
||
"""Specify to filter the records returned.""" | ||
filter: TestFilterRequiredDtoFilter! | ||
|
||
"""Specify to sort results.""" | ||
sorting: [TestFilterRequiredDtoSort!] = [] | ||
): String! | ||
} | ||
|
||
input CursorPaging { | ||
"""Paginate before opaque cursor""" | ||
before: ConnectionCursor | ||
|
||
"""Paginate after opaque cursor""" | ||
after: ConnectionCursor | ||
|
||
"""Paginate first""" | ||
first: Int | ||
|
||
"""Paginate last""" | ||
last: Int | ||
} | ||
|
||
"""Cursor for paging through collections""" | ||
scalar ConnectionCursor | ||
|
||
input TestFilterRequiredDtoFilter { | ||
and: [TestFilterRequiredDtoFilter!] | ||
or: [TestFilterRequiredDtoFilter!] | ||
requiredFilterableField: StringFieldComparison! | ||
} | ||
|
||
input StringFieldComparison { | ||
is: Boolean | ||
isNot: Boolean | ||
eq: String | ||
neq: String | ||
gt: String | ||
gte: String | ||
lt: String | ||
lte: String | ||
like: String | ||
notLike: String | ||
iLike: String | ||
notILike: String | ||
in: [String!] | ||
notIn: [String!] | ||
} | ||
|
||
input TestFilterRequiredDtoSort { | ||
field: TestFilterRequiredDtoSortFields! | ||
direction: SortDirection! | ||
nulls: SortNulls | ||
} | ||
|
||
enum TestFilterRequiredDtoSortFields { | ||
requiredFilterableField | ||
} | ||
|
||
"""Sort Directions""" | ||
enum SortDirection { | ||
ASC | ||
DESC | ||
} | ||
|
||
"""Sort Nulls Options""" | ||
enum SortNulls { | ||
NULLS_FIRST | ||
NULLS_LAST | ||
} |
71 changes: 71 additions & 0 deletions
71
packages/query-graphql/__tests__/__fixtures__/filter-required-field-input-type.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
type Query { | ||
test(input: TestComparisonDtoFilter!): Int! | ||
} | ||
|
||
input TestComparisonDtoFilter { | ||
and: [TestFilterRequiredComparisonFilter!] | ||
or: [TestFilterRequiredComparisonFilter!] | ||
id: NumberFieldComparison | ||
requiredField: BooleanFieldComparison! | ||
nonRequiredField: DateFieldComparison | ||
notSpecifiedField: NumberFieldComparison | ||
} | ||
|
||
input TestFilterRequiredComparisonFilter { | ||
and: [TestFilterRequiredComparisonFilter!] | ||
or: [TestFilterRequiredComparisonFilter!] | ||
id: NumberFieldComparison | ||
requiredField: BooleanFieldComparison! | ||
nonRequiredField: DateFieldComparison | ||
notSpecifiedField: NumberFieldComparison | ||
} | ||
|
||
input NumberFieldComparison { | ||
is: Boolean | ||
isNot: Boolean | ||
eq: Float | ||
neq: Float | ||
gt: Float | ||
gte: Float | ||
lt: Float | ||
lte: Float | ||
in: [Float!] | ||
notIn: [Float!] | ||
between: NumberFieldComparisonBetween | ||
notBetween: NumberFieldComparisonBetween | ||
} | ||
|
||
input NumberFieldComparisonBetween { | ||
lower: Float! | ||
upper: Float! | ||
} | ||
|
||
input BooleanFieldComparison { | ||
is: Boolean | ||
isNot: Boolean | ||
} | ||
|
||
input DateFieldComparison { | ||
is: Boolean | ||
isNot: Boolean | ||
eq: DateTime | ||
neq: DateTime | ||
gt: DateTime | ||
gte: DateTime | ||
lt: DateTime | ||
lte: DateTime | ||
in: [DateTime!] | ||
notIn: [DateTime!] | ||
between: DateFieldComparisonBetween | ||
notBetween: DateFieldComparisonBetween | ||
} | ||
|
||
""" | ||
A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format. | ||
""" | ||
scalar DateTime | ||
|
||
input DateFieldComparisonBetween { | ||
lower: DateTime! | ||
upper: DateTime! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...es/query-graphql/__tests__/__fixtures__/no-paging-query-args-required-filter-type.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
type Query { | ||
test( | ||
"""Specify to filter the records returned.""" | ||
filter: TestFilterRequiredDtoFilter! | ||
|
||
"""Specify to sort results.""" | ||
sorting: [TestFilterRequiredDtoSort!] = [] | ||
): String! | ||
} | ||
|
||
input TestFilterRequiredDtoFilter { | ||
and: [TestFilterRequiredDtoFilter!] | ||
or: [TestFilterRequiredDtoFilter!] | ||
requiredFilterableField: StringFieldComparison! | ||
} | ||
|
||
input StringFieldComparison { | ||
is: Boolean | ||
isNot: Boolean | ||
eq: String | ||
neq: String | ||
gt: String | ||
gte: String | ||
lt: String | ||
lte: String | ||
like: String | ||
notLike: String | ||
iLike: String | ||
notILike: String | ||
in: [String!] | ||
notIn: [String!] | ||
} | ||
|
||
input TestFilterRequiredDtoSort { | ||
field: TestFilterRequiredDtoSortFields! | ||
direction: SortDirection! | ||
nulls: SortNulls | ||
} | ||
|
||
enum TestFilterRequiredDtoSortFields { | ||
requiredFilterableField | ||
} | ||
|
||
"""Sort Directions""" | ||
enum SortDirection { | ||
ASC | ||
DESC | ||
} | ||
|
||
"""Sort Nulls Options""" | ||
enum SortNulls { | ||
NULLS_FIRST | ||
NULLS_LAST | ||
} |
65 changes: 65 additions & 0 deletions
65
packages/query-graphql/__tests__/__fixtures__/offset-query-args-required-filter-type.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
type Query { | ||
test( | ||
"""Limit or page results.""" | ||
paging: OffsetPaging = {limit: 10} | ||
|
||
"""Specify to filter the records returned.""" | ||
filter: TestFilterRequiredDtoFilter! | ||
|
||
"""Specify to sort results.""" | ||
sorting: [TestFilterRequiredDtoSort!] = [] | ||
): String! | ||
} | ||
|
||
input OffsetPaging { | ||
"""Limit the number of records returned""" | ||
limit: Int | ||
|
||
"""Offset to start returning records from""" | ||
offset: Int | ||
} | ||
|
||
input TestFilterRequiredDtoFilter { | ||
and: [TestFilterRequiredDtoFilter!] | ||
or: [TestFilterRequiredDtoFilter!] | ||
requiredFilterableField: StringFieldComparison! | ||
} | ||
|
||
input StringFieldComparison { | ||
is: Boolean | ||
isNot: Boolean | ||
eq: String | ||
neq: String | ||
gt: String | ||
gte: String | ||
lt: String | ||
lte: String | ||
like: String | ||
notLike: String | ||
iLike: String | ||
notILike: String | ||
in: [String!] | ||
notIn: [String!] | ||
} | ||
|
||
input TestFilterRequiredDtoSort { | ||
field: TestFilterRequiredDtoSortFields! | ||
direction: SortDirection! | ||
nulls: SortNulls | ||
} | ||
|
||
enum TestFilterRequiredDtoSortFields { | ||
requiredFilterableField | ||
} | ||
|
||
"""Sort Directions""" | ||
enum SortDirection { | ||
ASC | ||
DESC | ||
} | ||
|
||
"""Sort Nulls Options""" | ||
enum SortNulls { | ||
NULLS_FIRST | ||
NULLS_LAST | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.