Skip to content
Advertisement

How to use Netflix DGS graphql-dgs-extended-scalars JSON scalar (java/spring-boot, maven)?

I ran into the issue where I wanted to use graphql-dgs-extended-scalars, specifically the JSON scalar, but had trouble finding a clear tutorial on how to do it. I’m sure they’re out there, but just in case someone finds themselves in the same situation as me hopefully my simple explanation below will save them some time.

Advertisement

Answer

Installation

In pom file (maven specific)

JavaScript

In configuration file (eg, application.yml)

JavaScript

Using the scalar (JSON in this case)

In the schema

JavaScript

In the class that will be used as your input to the datafetcher

JavaScript

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.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement