Skip to content

Commit e98c5d4

Browse files
committed
Merge branch 'master' into query-traversal-improvements
2 parents 35f2f11 + 06ee733 commit e98c5d4

File tree

136 files changed

+4910
-535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+4910
-535
lines changed

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Thanks for contributing to graphql-java!
2+
3+
4+
Please be sure that you read the [Code of Conduct](CODE_OF_CONDUCT.md) before contributing to this project
5+
and please create a new Issue and discuss first what your are planing todo for bigger changes.
6+
7+
8+
The overall goal of graphql-java is to have a correct implementation of the [GraphQL Spec](https://github.com/facebook/graphql/) in a production ready way.
9+
10+
In order to achieve that we have a strong focus on maintainability and high test coverage:
11+
12+
- We expect new or modified unit test for every change (written in [Spock](http://spockframework.org/)).
13+
14+
- Your code should should be formatted with our IntelliJ [graphql-java-code-style](graphql-java-code-style.xml).
15+
16+
- We don't add a new dependency to graphql-java: dependency conflicts will make adaption of graphql-java harder for users,
17+
therefore we avoid adding any new dependency.
18+
19+
- graphql-java has a strict focus on executing a GraphQL request, this means JSON parsing, http communication, databases
20+
access etc is out of scope.
21+
22+
23+
If you have any question please open a Issue.
24+
25+
Thanks!
26+
27+

docs/defer.rst

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,7 @@ usual. There will be the usual ``ExecutionResult`` of initial data and then a
4545
In the query above, the ``post`` data will be send out in the initial result and then the comments and review data will be sent (in query order)
4646
down a ``Publisher`` later.
4747

48-
The first thing you need to put in place is including the ``defer`` directive into your schema. It wont work without it and graphql-java will
49-
give you an error if you don't.
50-
51-
52-
.. code-block:: java
53-
54-
GraphQLSchema buildSchemaWithDirective() {
55-
56-
GraphQLSchema schema = buildSchema();
57-
schema = schema.transform(builder ->
58-
builder.additionalDirective(Directives.DeferDirective)
59-
);
60-
return schema;
61-
}
62-
63-
64-
Then you execute your query as you would any other graphql query. The deferred results ``Publisher`` will be given to you via
48+
You execute your query as you would any other graphql query. The deferred results ``Publisher`` will be given to you via
6549
the ``extensions`` map
6650

6751

docs/exceptions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ These are not graphql errors in execution but rather totally unacceptable condit
4242
is thrown if the schema is not valid when built via
4343
graphql.schema.GraphQLSchema.Builder#build()`
4444

45+
- `graphql.execution.UnknownOperationException`
46+
47+
if multiple operations are defined in the query and
48+
the operation name is missing or there is no matching operation name
49+
contained in the GraphQL query.
4550

4651
- `graphql.GraphQLException`
4752

docs/execution.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Execution
44
Queries
55
-------
66

7-
To execute a query against a schema build a new ``GraphQL`` object with the appropriate arguments and then
7+
To execute a query against a schema, build a new ``GraphQL`` object with the appropriate arguments and then
88
call ``execute()``.
99

1010
The result of a query is an ``ExecutionResult`` which is the query data and/or a list of errors.

docs/locale/en/LC_MESSAGES/execution.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ msgstr ""
2828

2929
#: ../../execution.rst:7
3030
msgid ""
31-
"To execute a query against a schema build a new ``GraphQL`` object with "
31+
"To execute a query against a schema, build a new ``GraphQL`` object with "
3232
"the appropriate arguments and then call ``execute()``."
3333
msgstr ""
3434

docs/locale/en/LC_MESSAGES/schema.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ msgstr ""
103103

104104
#: ../../schema.rst:77
105105
msgid ""
106-
"When defining a schema via SDL, you provide the needed ``DataFetcher`` "
107-
"and ``TypeResolver`` when the executable schema is created."
106+
"When defining a schema via SDL, you provide the needed ``DataFetcher`` s "
107+
"and ``TypeResolver`` s when the executable schema is created."
108108
msgstr ""
109109

110110
#: ../../schema.rst:80
@@ -127,7 +127,7 @@ msgid ""
127127
msgstr ""
128128

129129
#: ../../schema.rst:131
130-
msgid "You wire this together using this builder pattern"
130+
msgid "You wire this together using this builder pattern:"
131131
msgstr ""
132132

133133
#: ../../schema.rst:161

docs/locale/zh_CN/LC_MESSAGES/execution.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ msgstr "查询(Queries)"
2626

2727
#: ../../execution.rst:7
2828
msgid ""
29-
"To execute a query against a schema build a new ``GraphQL`` object with "
29+
"To execute a query against a schema, build a new ``GraphQL`` object with "
3030
"the appropriate arguments and then call ``execute()``."
3131
msgstr "为了对 一个Schema 执行查询。需要先构造一个 ``GraphQL`` 对象,并带着一些参数去调用 ``execute()`` 方法."
3232

docs/locale/zh_CN/LC_MESSAGES/schema.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ msgstr "用 SDL 创建 Schema"
101101

102102
#: ../../schema.rst:77
103103
msgid ""
104-
"When defining a schema via SDL, you provide the needed ``DataFetcher`` "
105-
"and ``TypeResolver`` when the executable schema is created."
104+
"When defining a schema via SDL, you provide the needed ``DataFetcher`` s "
105+
"and ``TypeResolver`` s when the executable schema is created."
106106
msgstr "当使用SDL方法来开发时,你需要同时编写对应的 ``DataFetcher`` 和 ``TypeResolver``。"
107107

108108
#: ../../schema.rst:80
@@ -125,7 +125,7 @@ msgid ""
125125
msgstr "这里的绑定,包括 ``DataFetcher`` , ``TypeResolvers`` 与自定义 ``Scalar``."
126126

127127
#: ../../schema.rst:131
128-
msgid "You wire this together using this builder pattern"
128+
msgid "You wire this together using this builder pattern:"
129129
msgstr "用下页的Builder方法,就可以绑定Schema和Java程序"
130130

131131
#: ../../schema.rst:161
@@ -397,8 +397,8 @@ msgstr "订阅功能还未在规范中: ``graphql-java`` 现在只支持简单
397397

398398
#~ msgid ""
399399
#~ "When defining a schema via IDL, "
400-
#~ "you provide the needed ``DataFetcher`` "
401-
#~ "and ``TypeResolver`` when the schema is"
400+
#~ "you provide the needed ``DataFetcher`` s "
401+
#~ "and ``TypeResolver`` s when the schema is"
402402
#~ " created:"
403403
#~ msgstr ""
404404

docs/schema.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ what ``GraphqlObjectType`` should be used to represent it, and hence what data f
5555
public GraphQLObjectType getType(TypeResolutionEnvironment env) {
5656
Object javaObject = env.getObject();
5757
if (javaObject instanceof Wizard) {
58-
return (GraphQLObjectType) env.getSchema().getType("WizardType");
58+
return env.getSchema().getObjectType("WizardType");
5959
} else if (javaObject instanceof Witch) {
60-
return (GraphQLObjectType) env.getSchema().getType("WitchType");
60+
return env.getSchema().getObjectType("WitchType");
6161
} else {
62-
return (GraphQLObjectType) env.getSchema().getType("NecromancerType");
62+
return env.getSchema().getObjectType("NecromancerType");
6363
}
6464
}
6565
};
@@ -69,7 +69,7 @@ what ``GraphqlObjectType`` should be used to represent it, and hence what data f
6969
Creating a schema using the SDL
7070
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7171

72-
When defining a schema via SDL, you provide the needed ``DataFetcher`` and ``TypeResolver``
72+
When defining a schema via SDL, you provide the needed ``DataFetcher`` s and ``TypeResolver`` s
7373
when the executable schema is created.
7474

7575
Take for example the following static schema definition file called ``starWarsSchema.graphqls``:
@@ -123,7 +123,7 @@ runtime wiring to make it a truly executable schema.
123123
The runtime wiring contains ``DataFetcher`` s, ``TypeResolvers`` s and custom ``Scalar`` s that are needed to make a fully
124124
executable schema.
125125

126-
You wire this together using this builder pattern
126+
You wire this together using this builder pattern:
127127

128128
.. code-block:: java
129129
@@ -337,12 +337,12 @@ SDL Example:
337337

338338
.. code-block:: graphql
339339
340-
interface Cat {
340+
type Cat {
341341
name: String;
342342
lives: Int;
343343
}
344344
345-
interface Dog {
345+
type Dog {
346346
name: String;
347347
bonesOwned: int;
348348
}

graphql-java-code-style.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<code_scheme name="graphql-java" version="173">
2+
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
3+
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
4+
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true"/>
5+
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true"/>
6+
<option name="JD_P_AT_EMPTY_LINES" value="false"/>
7+
<GroovyCodeStyleSettings>
8+
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
9+
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
10+
</GroovyCodeStyleSettings>
11+
<JavaCodeStyleSettings>
12+
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
13+
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
14+
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true"/>
15+
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true"/>
16+
<option name="JD_P_AT_EMPTY_LINES" value="false"/>
17+
</JavaCodeStyleSettings>
18+
</code_scheme>

0 commit comments

Comments
 (0)