Skip to content

Commit d1dd724

Browse files
committed
Add docs
1 parent 9fca81e commit d1dd724

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

src/main/java/graphql/normalized/ExecutableNormalizedOperationFactory.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,61 @@ public static Options defaultOptions() {
8585
Integer.MAX_VALUE);
8686
}
8787

88+
/**
89+
* Locale to use when parsing the query.
90+
* <p>
91+
* e.g. can be passed to {@link graphql.schema.Coercing} for parsing.
92+
*
93+
* @param locale the locale to use
94+
* @return new options object to use
95+
*/
8896
public Options locale(Locale locale) {
8997
return new Options(this.graphQLContext, locale, this.maxChildrenDepth);
9098
}
9199

100+
/**
101+
* Context object to use when parsing the operation.
102+
* <p>
103+
* Can be used to intercept input values e.g. using {@link graphql.execution.values.InputInterceptor}.
104+
*
105+
* @param graphQLContext the context to use
106+
* @return new options object to use
107+
*/
92108
public Options graphQLContext(GraphQLContext graphQLContext) {
93109
return new Options(graphQLContext, this.locale, this.maxChildrenDepth);
94110
}
95111

112+
/**
113+
* Controls the maximum depth of the operation. Can be used to prevent
114+
* against malicious operations.
115+
*
116+
* @param maxChildrenDepth the max depth
117+
* @return new options object to use
118+
*/
96119
public Options maxChildrenDepth(int maxChildrenDepth) {
97120
return new Options(this.graphQLContext, this.locale, maxChildrenDepth);
98121
}
99122

123+
/**
124+
* @return context to use during operation parsing
125+
* @see #graphQLContext(GraphQLContext)
126+
*/
100127
public GraphQLContext getGraphQLContext() {
101128
return graphQLContext;
102129
}
103130

131+
/**
132+
* @return locale to use during operation parsing
133+
* @see #locale(Locale)
134+
*/
104135
public Locale getLocale() {
105136
return locale;
106137
}
107138

139+
/**
140+
* @return maximum children depth before aborting parsing
141+
* @see #maxChildrenDepth(int)
142+
*/
108143
public int getMaxChildrenDepth() {
109144
return maxChildrenDepth;
110145
}

src/test/groovy/graphql/normalized/ExecutableNormalizedOperationFactoryTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2873,6 +2873,6 @@ fragment personName on Person {
28732873
ExecutableNormalizedOperationFactory.Options.defaultOptions().maxChildrenDepth(5))
28742874
28752875
then:
2876-
notThrown(Throwable)
2876+
noExceptionThrown()
28772877
}
28782878
}

0 commit comments

Comments
 (0)