You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is mostly a question, or perhaps otherwise could be turned into a feature request.
Our API has several 'metric' endpoints defined, which are returning number / float types.
But now we're running into the issue that some calculations might result into NaN or Inf values, which are valid floats in Golang but not in JSON.
The solution, is to serialize metric values to string, as e.g. Prometheus is doing.
But since in our code we have the value as float, if we define the API with string that means we 'manually' have to convert all (nested) values, which is quite cumbersome.
I'd like to understand if I'm overlooking some setting or feature where the generated code could handle this conversion automatically? Or otherwise there seems to be a definition for a Decimal128 format which is not mandatory to implement but is listed to support this out of the box. So perhaps support for this type could be added?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This is mostly a question, or perhaps otherwise could be turned into a feature request.
Our API has several 'metric' endpoints defined, which are returning
number
/float
types.But now we're running into the issue that some calculations might result into
NaN
orInf
values, which are valid floats in Golang but not in JSON.The solution, is to serialize metric values to
string
, as e.g. Prometheus is doing.But since in our code we have the value as
float
, if we define the API withstring
that means we 'manually' have to convert all (nested) values, which is quite cumbersome.I'd like to understand if I'm overlooking some setting or feature where the generated code could handle this conversion automatically? Or otherwise there seems to be a definition for a
Decimal128
format which is not mandatory to implement but is listed to support this out of the box. So perhaps support for this type could be added?Beta Was this translation helpful? Give feedback.
All reactions