I add functionality to the API in GraphQL and in the request I need to pass a field in which there is a structure of the following form:

 "services": { "29bd525c-c6a1-44ad-a993-06894df2154d": { "totalSumInKops": 10000 }, "4723ebf6-a6ac-4fc6-8148-a94e7819c108": { "totalSumInKops": 5000 } } 

This structure is parsed as a HashMap :

 @Override public Set<Service> convert(Map<String, Map<String, Long>> map) { return map.entrySet().stream().map(stringMapEntry -> { Service service = new Service(); service.setTotalSumInKops(stringMapEntry.getValue().get("totalSumInKops")); // service.setInvoice(); service.setServiceUid(UUID.fromString(stringMapEntry.getKey())); return service; }).collect(Collectors.toSet()); } 

But I do not know how to determine the type of this field in the GraphQL scheme. Now I wrote this:

 input ServiceEntryInput { totalSumInKops: Long } input ServiceInput { serviceUid: UUID serviceEntry: ServiceEntryInput } input UpdateInvoiceInput { services: [ServiceInput] } 

And this scheme does not work. Tell me, please, how to correctly determine the type of this field.

  • UUID - there is no such base type in GraphQL - Sergey Konovalov
  • Or in Java it is given to the ID? - Sergey Konovalov
  • @ Sergey Konovalov, this is our own scalar. - typemoon

0