Installation
In pom file (maven specific)
<dependency>
<groupId>com.netflix.graphql.dgs</groupId>
<artifactId>graphql-dgs-extended-scalars</artifactId>
<version>${netflix.graphql.dgs.version}</version>
</dependency>
In configuration file (eg, application.yml)
dgs:
graphql:
extensions:
scalars:
objects:
enabled: true
Using the scalar (JSON in this case)
In the schema
...
type SomeType {
thing: JSON!
}
...
input SomeTypeInput {
thing: JSON!
}
...
scalar JSON
In the class that will be used as your input to the datafetcher
public class SomethingDTO
{
/**
* This does not have to be a Map, you could use another
* reasonable object like JSONObject, etc.
*/
public Map<String, Object> thing;
}
You can then pass in as an argument a json formatted object in your query of arbitrary shape.
This was just for the JSON scalar, but the pattern follows for most (all?) the other scalars found in the lib.