-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make String parseValue coercion consistent with JS implementation & Gradle JCenter fix #3030
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dd237fe
Make String parseValue coercing consistent with JS implementation
dondonz a05f6c4
Fix typos
dondonz 3a2832a
Merge branch 'master' into string-coercion-alignment
dondonz 28cc1f2
Fix incorrect bintray redirect
dondonz 6388782
Add pluginManagement
dondonz 7515f3a
Amend settings.gradle
dondonz d4c1282
Reorder settings
dondonz 9ddffb4
Update jmh plugin
dondonz d174313
Prevent metadata redirection for jmh plugin
dondonz f31ceb4
Add comment explaining metadata redirection problem
dondonz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,16 @@ | ||
| rootProject.name = 'graphql-java' | ||
| pluginManagement { | ||
| repositories { | ||
| mavenCentral() | ||
| maven { | ||
| url 'https://plugins.gradle.org/m2' | ||
| metadataSources { | ||
| // Avoid redirection to defunct JCenter when Gradle module metadata is not published by a plugin (e.g. JMH plugin) | ||
| ignoreGradleMetadataRedirection() | ||
| mavenPom() | ||
| artifact() | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| rootProject.name = 'graphql-java' | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import graphql.execution.CoercedVariables | |
| import graphql.language.BooleanValue | ||
| import graphql.language.StringValue | ||
| import graphql.schema.CoercingParseLiteralException | ||
| import graphql.schema.CoercingParseValueException | ||
| import spock.lang.Shared | ||
| import spock.lang.Specification | ||
| import spock.lang.Unroll | ||
|
|
@@ -54,7 +55,6 @@ class ScalarsStringTest extends Specification { | |
| def "String serialize #value into #result (#result.class)"() { | ||
| expect: | ||
| Scalars.GraphQLString.getCoercing().serialize(value, GraphQLContext.default, Locale.default) == result | ||
| Scalars.GraphQLString.getCoercing().parseValue(value, GraphQLContext.default, Locale.default) == result | ||
|
Member
Author
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. Splitting out tests for |
||
|
|
||
| where: | ||
| value | result | ||
|
|
@@ -64,10 +64,9 @@ class ScalarsStringTest extends Specification { | |
| } | ||
|
|
||
| @Unroll | ||
| def "String serialize #value into #result (#result.class) with deprecated methods"() { | ||
| def "String serialize #value into #result (#result.class) with deprecated method"() { | ||
| expect: | ||
| Scalars.GraphQLString.getCoercing().serialize(value) == result // Retain deprecated method for test coverage | ||
| Scalars.GraphQLString.getCoercing().parseValue(value) == result // Retain deprecated method for test coverage | ||
|
|
||
| where: | ||
| value | result | ||
|
|
@@ -76,4 +75,35 @@ class ScalarsStringTest extends Specification { | |
| customObject | "foo" | ||
| } | ||
|
|
||
| def "String parseValue value into result"() { | ||
| expect: | ||
| Scalars.GraphQLString.getCoercing().parseValue("123ab", GraphQLContext.default, Locale.default) == "123ab" | ||
| } | ||
|
|
||
| def "String parseValue value into result with deprecated method"() { | ||
| expect: | ||
| Scalars.GraphQLString.getCoercing().parseValue("123ab") == "123ab" // Retain deprecated method for test coverage | ||
| } | ||
|
|
||
| @Unroll | ||
| def "String parseValue throws exception for non-String values"() { | ||
| when: | ||
| Scalars.GraphQLString.getCoercing().parseValue(literal, GraphQLContext.default, Locale.default) | ||
| then: | ||
| def ex = thrown(CoercingParseValueException) | ||
|
|
||
| where: | ||
| literal | _ | ||
| 123 | _ | ||
| true | _ | ||
| customObject | _ | ||
| } | ||
|
|
||
| def "String parseValue English exception message"() { | ||
| when: | ||
| Scalars.GraphQLString.getCoercing().parseValue(9001, GraphQLContext.default, Locale.ENGLISH) | ||
| then: | ||
| def ex = thrown(CoercingParseValueException) | ||
| ex.message == "Expected a String input, but it was a 'Integer'" | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Snippet from gradle/gradle#22864 (comment)