Hello,
I’m using ROSDK to communicate between servers and clients that I totally control, and it’s been working just fine with a TROBinMessage
format.
Now, I have been asked to “open” some parts of the application to the external world and for that I’m using TROJSONMessage
because the JSON format is somewhat standard in this area.
One thing that I’m missing, though, is the JSON schema for the data that is read and written by TROJSONMessage
.
I understand that it totally depends on what I’m transferring but in my case, I’m controlling it just fine as it’s always going to be an array of struct items, generated by such code:
var JSONMessage := TROJSONMessage.Create(nil);
try
var ROMessage := JSONMessage as IROMessage;
ROMessage.Initialize(nil, 'dummy', 'dummy', mtResponse);
ROMessage.Write('variables', System.TypeInfo(TVariablesArray), ROVariables, []);
ROMessage.WriteToStream(AStream);
finally
JSONMessage.Free;
end;
This gives me this nice JSON:
{
"version":"1.1",
"result":[
{
"Description":"",
"Filter":"",
"Id":-1,
"Kind":"evkString",
"Locked":false,
"Max":null,
"Min":null,
"Name":"FirstVar",
"Value":"FirstValue"
},
{
"Description":"",
"Filter":"",
"Id":-1,
"Kind":"evkString",
"Locked":false,
"Max":null,
"Min":null,
"Name":"SecondVar",
"Value":"SecondValue"
}
]
}
Kind
is an enum, while Min
and Max
are variants.
Is there a way to generate a JSON Schema for the TVariablesArray
that is defined in the RODL file?