Array of array field in entity type


#1

Is there a way to have a field that is an an array of arrays of doubles in a type? I am trying to do something like below to make an array of coordinate pairs:

entity type GraphType schema name "GRPHTYP" {
  coordinates: [[double]] schema suffix "CRDS"
}

This code throws an error during provisioning. I have also tried [anyof([double])], which provisions but throws an obscure error during runtime:

“Unexpected token VALUE_NUMBER_FLOAT when expecting START_OBJECT or END_ARRAY in JSON document at 1:65”.


#2

nested arrays are not supported in the type system.
You should instead define something like the following:

type Coordinate2d {
x: double
y: double
}

entity type GraphType … {
coordinates: [ Coordinate2d ]
}

of course, what youre doing seems like it should already exist in the platform. Are you trying to achieve some use case or are you just playing around with whats possible?


#3

Highcharts take a data field in this form when the x coordinates are irregular intervals. We were trying to leverage this to pair nicely with the UI component.


#4

@yushi.homma What was the error in the first case?


#5

The error was:
Unable to upsert collection for type GraphType: Map value should be primitive or reference in field coordinates in type GraphType.",targetType:"GraphType",listenerType:"UpdateSchemaListener"}