-
Notifications
You must be signed in to change notification settings - Fork 357
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
Configure client generate parser options #1586
Configure client generate parser options #1586
Conversation
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.
Looks good, just few nitpicks about the docs and the defaults.
@@ -263,6 +289,7 @@ resulting generated code will be automatically added to the project main source | |||
| `serializer` | GraphQLSerializer | | JSON serializer that will be used to generate the data classes.<br/>**Default value is:** `GraphQLSerializer.JACKSON`. | | |||
| `schemaFile` | File | yes | GraphQL schema file that will be used to generate client code. | | |||
| `useOptionalInputWrapper` | Boolean | | Boolean opt-in flag to wrap nullable arguments in `OptionalInput` that distinguish between `null` and undefined/omitted value.<br/>**Default value is:** `false`.<br/>**Command line property is**: `useOptionalInputWrapper` | | |||
| `parserOptions` | GraphQLParserOptions | | Configures the settings used when parsing GraphQL queries and schema definition language documents. | |
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.
let's keep the alphabetical order -> can you also fix serializer
<-> schemaFile
order?
*this comment applies to all doc changes
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.
should we also specify somewhere in the docs what are the available options?
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.
Fixed the ordering and added the specific options and defaults in the docs.
* Configure options for parsing GraphQL queries and schema definition language documents. Settings | ||
* here override the defaults set by GraphQL Java. | ||
*/ | ||
data class GraphQLParserOptions( |
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.
instead of null, should those values have some defaults? i.e. when configuring the plugin I have no idea what would be the default, I have to look up the graphql-java
code to find out the defaults
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.
I've set default values that match current graphql-java defaults. They are not particularly accessible in the plugin sources, and if graphql-java changes these we will no longer inherit their defaults. This is easy to reverse in the future if we need to.
Client generator module is not intended to be called outside of the maven/gradle plugin which abstract it away so I think it is fine. Unsure if we need to be able to configure all options but why not. |
*/ | ||
data class GraphQLParserOptions( | ||
/** Modify the maximum number of tokens read to prevent processing extremely large queries */ | ||
var maxTokens: Int? = 15000, |
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.
if those have default values set -> does it make sense to keep those fields as nullable?
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.
If you wish to go back to the default value (whatever it is) then you can explicitly set it as null.
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.
seems odd experience for the end user - if the intent is to keep null as not-set and use defaults from graphql-java
lets revert back to keep those values null and document the behavior in the docs
* Configure client generate parser options * Fix star import failure from ktlint * Set defaults, update documentation, fix name of parser options class for maven plugin * Do not set default for parser options, use null to inherit default from graphql-java
…Group#1592) * Configure client generate parser options * Fix star import failure from ktlint * Set defaults, update documentation, fix name of parser options class for maven plugin * Do not set default for parser options, use null to inherit default from graphql-java
…#1925) Enables configuration of the maxCharacters and maxParserDepth parser options for GraphQL Java. ### 📝 Description See [ParserOptions](https://github.com/graphql-java/graphql-java/blob/7c381cc9d61c1e1838a2487d9b24974c451f23a2/src/main/java/graphql/parser/ParserOptions.java#L13) for the values configured in graphql-java. ### 🔗 Related Issues Extensions of #1586 with additional parameters that have been added to graphql-java.
📝 Description
Allows a user of the client generator to set the parser options for graphql-java. The base
generateClient()
function accepts a function type with receiver to customise the builder object, whilst the gradle and maven plugins provide an explicit list of (current) options permitted by graphql-java, with the exception of the parsingListener.🔗 Related Issues
Resolves #1526
Notes
ParserOptions.Builder
the client module now exposes this in it's public API, and would therefore inherit breaking changes made to this class.