graphql with map type: Part 2

follow up to https://lwpro2.wordpress.com/2022/07/16/graphql-with-map-type/

Looks like its an issue where I have missed out. graphql already has some Graphql java extended scalars, so instead of manually creating an extension with DgsScalar (where the return type should be Object I think instead of String), it could directly use JSON or Object as type, which would be parsed well by dgs-client library.

so the change need is in pom.xml, include the corresponding version of `graphql-dgs-extended-scalars`

then in the schema, just import and define the type for the attributes

scalar JSON

type Position {
  ...
  cashByCurrencyUnadjustedUsd: JSON
}

this is the only needed change. From the dgs-client, it should just work out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s