Skip to content

Commit d008832

Browse files
committed
Fixes up JavaDoc on what is allowed to come back from scalars serialize
1 parent 806cfe7 commit d008832

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/main/java/graphql/schema/Coercing.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ public interface Coercing<I, O> {
2525

2626
/**
2727
* Called to convert a Java object result of a DataFetcher to a valid runtime value for the scalar type.
28-
*
28+
* <p>
29+
* Note : Throw {@link graphql.schema.CoercingSerializeException} if there is fundamental
30+
* problem during serialisation, don't return null to indicate failure.
31+
* <p>
2932
* Note : You should not allow {@link java.lang.RuntimeException}s to come out of your serialize method, but rather
3033
* catch them and fire them as {@link graphql.schema.CoercingSerializeException} instead as per the method contract.
3134
*
3235
* @param dataFetcherResult is never null
3336
*
34-
* @return a serialized value which is never null
37+
* @return a serialized value which may be null.
3538
*
3639
* @throws graphql.schema.CoercingSerializeException if value input can't be serialized
3740
*/
3841
O serialize(Object dataFetcherResult) throws CoercingSerializeException;
3942

4043
/**
4144
* Called to resolve a input from a query variable into a Java object acceptable for the scalar type.
42-
*
45+
* <p>
4346
* Note : You should not allow {@link java.lang.RuntimeException}s to come out of your parseValue method, but rather
4447
* catch them and fire them as {@link graphql.schema.CoercingSerializeException} instead as per the method contract.
4548
*
@@ -54,7 +57,7 @@ public interface Coercing<I, O> {
5457
/**
5558
* Called during query validation to convert an query input AST node into a Java object acceptable for the scalar type. The input
5659
* object will be an instance of {@link graphql.language.Value}.
57-
*
60+
* <p>
5861
* Note : You should not allow {@link java.lang.RuntimeException}s to come out of your parseLiteral method, but rather
5962
* catch them and fire them as {@link graphql.schema.CoercingParseLiteralException} instead as per the method contract.
6063
*
@@ -69,11 +72,11 @@ public interface Coercing<I, O> {
6972
/**
7073
* Called during query execution to convert an query input AST node into a Java object acceptable for the scalar type. The input
7174
* object will be an instance of {@link graphql.language.Value}.
72-
*
75+
* <p>
7376
* Note : You should not allow {@link java.lang.RuntimeException}s to come out of your parseLiteral method, but rather
7477
* catch them and fire them as {@link graphql.schema.CoercingParseLiteralException} instead as per the method contract.
75-
*
76-
* Many scalar types don't need to implement this method because they do'nt take AST {@link graphql.language.VariableReference}
78+
* <p>
79+
* Many scalar types don't need to implement this method because they don't take AST {@link graphql.language.VariableReference}
7780
* objects and convert them into actual values. But for those scalar types that want to do this, then this
7881
* method should be implemented.
7982
*

0 commit comments

Comments
 (0)