jxtxzzw / vscode-azure-iot-toolkit

Azure IoT Hub Toolkit for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit
Other
0 stars 0 forks source link

Will we check if dummy json is valid before sending message? #11

Open xinyiz1226 opened 5 years ago

jxtxzzw commented 5 years ago

Yes. And the procedure is as follows.

When click the send button, a validator will be triggered and I will check if the Dummy Json is right in syntax. Only the valid one will be sent to the server end. So, input like {{#repeat 2}} *** {{/rep} will not be sent to the server end.

As long as the syntax is valid, I will send it to the local server, then the Dummy JSON parser will generate random message(s) based on the template, namely, generate the {{int}}, {{repeat}} parts.

But since the Dummy Json parser can handle ordinary situations(including plain text), and we do not know what user really wants, so I can not check if the generated message is valid in JSON syntax. I mean, I can just use the Dummy JSON {{repeat}} to generate a list of random numbers but deliberately not in JSON format. e.g. [ {{repeat 3}} {{int 1 100}} {{/repeat}} ] => [1, 3, 10].

So, what I do next just follows the generally accepted practice: