Closed ComLock closed 3 years ago
I think this is too specific for this library, you should rather add custom scalars to your own implementations.
ASFAIK there is no JS API for custom scalars available?
Like they are doing here: https://stackoverflow.com/questions/49897319/graphql-union-scalar-type new GraphQLScalarType
Personally I was thinking of an object with lat and long, not a string...
But I guess object is just possible as input, not output https://developer.enonic.com/docs/xp/stable/api/lib-value#geopoint
Ask @anatol-sialitski how this was done for Guillotine perhaps?
In Guillotine we use object for both object output type and for object input type.
But GeoPoint output object type has three fields:
value
as string lat,lonlatitude
as floatlongitude
as floatI fully agree with @sigdestad's comment https://github.com/enonic/lib-graphql/issues/95#issuecomment-892587323
@anatol-sialitski Yes, but how do I make custom scalar?
@ComLock Please have a look at these files:
The same you can do in your application/lib
@anatol-sialitski Nice, but sure would be nice with JS API for creating custom scalars... Perhaps I should make a new issue for that and close this one?
Anyway you have to implement COERCING on Java. I do not see simple solution to create a scalar by a user using lib-graphql now.
In order to do not block your development you can use examples from my previous reply.
It would be nice to have a type for GeoPoint