The JADE 2022 release meets tomorrow’s business demands.
Our client is sending a json payload to our Rest API with elements that start with uppercase characters. But this causes an exception because our proxy request classes properties defined in Jade can only ever start with a lowercase character. We have had to transform the json message in an Azure middleware layer to work around. Could the JSON parser be modified to automatically convert a starting uppercase character to lower case before validating the element against our request properties.
Here is a sample of a payload they send, I have processed this thru a JSON formatter and validator and it says it is valid json.
{
"Stepid": "BasicItem-387882",
"Links": {
"Product_To_BrandHierarchy": "GLITTER G"
},
"Values": {
"AT_ProductKey": "2559293",
"AT_ProductShortName": "B/G SS SOLID 8MM 68MM",
"AT_InStoreStartDate": "19-Feb-2019",
"AT_HighRiskIndicator": "N",
"AT_Character": "BUNNY;CAR;CAT",
"AT_ShippingProductWeight": "0.10 kg"
}
}
Tim, I like your first idea "Provide the ability to have "Web names" on our JADE properties, e.g. by annotations which will allow for mapping of these json properties to our JADE properties"
Attachments Open full size
BeeJay, when we told the client that we needed lowercase, the response was that Jade should be able to handle uppercase because valid json syntax. When it is a clients bespoke Jade system talking to another of their systems, it becomes our problem. So we currently intercepting raw json in processRequest and modifying it before it gets to parser.
Attachments Open full size
I may be missing something, but as the Rest service provider aren't you the one who documents the APIs for your Rest service? As such, the document for the Rest APIs could specify that the property names all need to start with a lower case character, and then it's up to the consumer(s) of your Rest service API to follow the documented requirements?
Otherwise, isn't this somewhat of a case of the tail wagging the dog having a consumer of your Rest service API dictating what they're going to send through to your Rest service provider and expecting you to adjust your Rest service API to suit them?
Attachments Open full size
Edit to the above: by "uppercase the first letters" I meant "lowercase the first letters" :)
Or more generally, "make identifiers in the json string which are not valid JADE names into valid JADE names."
Attachments Open full size
I don't think it's viable to simply uppercase the first letters as a general rule, but there's two main ways we could make life easier:
Provide the ability to have "Web names" on our JADE properties, e.g. by annotations which will allow for mapping of these json properties to our JADE properties.
Provide the ability to deserialize json strings to jdos (which helps some other things also)
Attachments Open full size