Hi,
I am trying to use templates to model domain specific connections between assets and time series in CDF, and I have come across an issue that I would like some feedback on.
If I have the following schema type:
type StringOrNumber @template {
Asset: Asset
NumericTS: TimeSeries
}
and do the following query:
query StringOrNumber {
stringOrNumberQuery {
items {
NumericTS {
__typename
isString
datapoints(limit: 1) {
__typename
timestamp
value
}
}
}
}
}
then the datapoint output __typename has the value “DatapointString” even though the timeseries is not a string timeseries:
{
"data": {
"stringOrNumberQuery": {
"items": [
{
"NumericTS": {
"__typename": "TimeSeries",
"isString": false,
"datapoints": [
{
"__typename": "DatapointString",
"timestamp": 1634534671570,
"value": 14.3
}
]
}
}
]
}
}
}
The values appear correctly in the query output, so I first noticed the problem when trying to use Strawberry Shake to auto-generate C# types from my query. It uses the __typename value to determine which class to instantiate when deserializing the results into its auto-generated classes - consequently I can not get the data values out since Strawberry Shake instantiates a class that expects “stringValue” in the result if the __typename equals “DatapointString”.
I can work around it by hand coding my C# classes, but it seems either my understanding or the template implementation is incorrect.
Best Regards,
Tom