When working on sending JSON objects from the update-api, we should be able to handle many scenarios for data types, one of the non-trivial case is handling null. The protobuf object created by Go when handling null values when it is used via Go vs the protobuf object created by Go when they are passed through Ballerina are different. We need to figure out what is happening when the protobuf object is created from JSON. For both cases each language makes up that protobuf object.
{
"properties": {
"empty_str": "",
"zero": 0,
"null_val": null
}
}
Ballerina
[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"properties" value:{struct_value:{fields:{key:"empty_str" value:{string_value:""}} fields:{key:"null_val" value:{}} fields:{key:"zero" value:{number_value:0}}}}}}
Go
[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"properties" value:{struct_value:{fields:{key:"empty_str" value:{string_value:""}} fields:{key:"null_val" value:{null_value:NULL_VALUE}} fields:{key:"zero" value:{number_value:0}}}}}}
This issue causes a problem down the inference engine by throwing the following error.
2025/05/23 07:58:34 Failed to generate schema: failed to generate scalar property schema: no scalar field found
When working on sending JSON objects from the
update-api, we should be able to handle many scenarios for data types, one of the non-trivial case is handling null. The protobuf object created by Go when handling null values when it is used via Go vs the protobuf object created by Go when they are passed through Ballerina are different. We need to figure out what is happening when the protobuf object is created from JSON. For both cases each language makes up that protobuf object.{ "properties": { "empty_str": "", "zero": 0, "null_val": null } }Ballerina
[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"properties" value:{struct_value:{fields:{key:"empty_str" value:{string_value:""}} fields:{key:"null_val" value:{}} fields:{key:"zero" value:{number_value:0}}}}}}Go
[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"properties" value:{struct_value:{fields:{key:"empty_str" value:{string_value:""}} fields:{key:"null_val" value:{null_value:NULL_VALUE}} fields:{key:"zero" value:{number_value:0}}}}}}This issue causes a problem down the inference engine by throwing the following error.