-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixes two issues in the generation of mocks. (#3120)
- Loading branch information
1 parent
efdae87
commit 9961d2b
Showing
6 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
10 changes: 10 additions & 0 deletions
10
...egenIntegrationTests/Tests/3120-listOfCustomScalarsNeedsSetScalarList/README.MD
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,10 @@ | ||
# Overview | ||
|
||
When a field has a list type containing custom scalars, the generated initializer for mock objects should use a version of the `_set` function that is appropriate for that type. | ||
Previously, the `_setList` function was used for all lists of objects, even if it would not compile since custom scalars do not conform to `GraphQLField`. | ||
|
||
## Reference Issue: https://github.com/apollographql/apollo-ios/pull/3120 | ||
|
||
## Solution | ||
|
||
All properties that are lists of scalars should use the `_setScalarList` function when initialized inside mock objects. |
6 changes: 6 additions & 0 deletions
6
...odegenIntegrationTests/Tests/3120-listOfCustomScalarsNeedsSetScalarList/operation.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,6 @@ | ||
query TestMeWithMocks { | ||
testMeWithMocks { | ||
scalarList | ||
nullableScalarList | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
.../CodegenIntegrationTests/Tests/3120-listOfCustomScalarsNeedsSetScalarList/schema.graphqls
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,10 @@ | ||
type Query { | ||
testMeWithMocks: Event! | ||
} | ||
|
||
type Event { | ||
scalarList: [Text!]! | ||
nullableScalarList: [Text]! | ||
} | ||
|
||
scalar Text |