Skip to content

Missing support for String and Object arrays #166

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

Closed
anotender opened this issue Aug 20, 2019 · 2 comments · Fixed by #171
Closed

Missing support for String and Object arrays #166

anotender opened this issue Aug 20, 2019 · 2 comments · Fixed by #171

Comments

@anotender
Copy link
Contributor

Application fails when in encounters String[] or Object[] while building schema. It is missing in the scalarsRegistry in the JavaScalars class and the library tries to register it but it fails because of regexp check failure. The solution that works for our case is to add following entries to the scalarsRegistry:

scalarsRegistry.put(String[].class, new GraphQLScalarType("StringArray", "StringArray type", new GraphQLObjectCoercing()));
scalarsRegistry.put(Object[].class, new GraphQLScalarType("ObjectArray", "ObjectArray type", new GraphQLObjectCoercing()));
@igdianov
Copy link
Collaborator

@anotender Do you think it would make sense to support direct mapping of Java arrays into GraphQL lists type wrapper, i. e. String[] > [String]?

@anotender
Copy link
Contributor Author

@igdianov for the readability of the schema it looks like it is a good idea. In my opinion it could be implemented this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants