★ wanayoo — archive 1999 https://github.com/graphql-java/graphql-java/pull/1772Nouvelle recherche | Portail wanayoo
Skip to content
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

add custom scalar Specification URL #1772

Merged
merged 12 commits into from May 21, 2020
Merged

add custom scalar Specification URL #1772

merged 12 commits into from May 21, 2020

Conversation

@andimarek
Copy link
Member

@andimarek andimarek commented Jan 24, 2020

This is a major new feature for GraphQL: it allows you to specify a url for a custom scalar which should point to a document describing this scalar.

It is implemented via directive for SDL or as property on GraphQLScalar.

scalar MyScalar @specifiedBy(url: "https://example.com/myScala")
...

The specifiedByUrl can then be queried via Introspection:

{__type(name: "MyScalar") {name specifiedByUrl} }

See graphql/graphql-spec#649 and graphql/graphql-js#2276 for all the details.

andimarek added 8 commits Jan 19, 2020
@andimarek andimarek changed the title add custom scalar Specification URL (WIP) add custom scalar Specification URL May 20, 2020
@andimarek andimarek added this to the 15.0 milestone May 20, 2020
andimarek added 3 commits May 20, 2020
.defaultValue("No longer supported")
.description("The reason for the deprecation"))
.validLocations(FIELD_DEFINITION, ENUM_VALUE)
.build();

/**
* The "specifiedBy" directive allows to provide a specification URL for a Scala

This comment has been minimized.

@bbakerman

bbakerman May 21, 2020
Member

spillin - Scalar (not Scala - never Scala)

@@ -73,10 +74,16 @@ public GraphQLScalarType(String name, String description, Coercing coercing) {
@Internal
@Deprecated
public GraphQLScalarType(String name, String description, Coercing coercing, List<GraphQLDirective> directives, ScalarTypeDefinition definition) {

This comment has been minimized.

@bbakerman

bbakerman May 21, 2020
Member

one version we need to remove the old constructors!

}
Argument urlArgument = specifiedByDirective.get().getArgument("url");
StringValue url = (StringValue) urlArgument.getValue();
return url.getValue();

This comment has been minimized.

@bbakerman

bbakerman May 21, 2020
Member

Thought - Will it always be non null arg values?

This comment has been minimized.

@andimarek

andimarek May 21, 2020
Author Member

yes it is: url is required non null

@andimarek andimarek merged commit 0b611f2 into master May 21, 2020
3 checks passed
3 checks passed
build
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@andimarek andimarek deleted the specified-by-url branch Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.