Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate discovery messages against JSON schema #135

Open
bergie opened this issue May 16, 2017 · 2 comments
Open

Validate discovery messages against JSON schema #135

bergie opened this issue May 16, 2017 · 2 comments

Comments

@bergie
Copy link
Member

bergie commented May 16, 2017

Now coordinator crashes on malformed discovery messages, as reported in c-base/c-flo#35

May 14 03:31:26 c-flo node[3134]: Participant discovery failed: Discovery message missing .inports
May 14 03:31:26 c-flo node[3134]:  Error: Discovery message missing .inports
May 14 03:31:26 c-flo node[3134]:     at Coordinator.participantDiscovered (/opt/c-flo/node_modules/msgflo/src/coordinator.coffee:168:11)
May 14 03:31:26 c-flo node[3134]:     at Coordinator.handleFbpMessage (/opt/c-flo/node_modules/msgflo/src/coordinator.coffee:160:8)
May 14 03:31:26 c-flo node[3134]:     at /opt/c-flo/node_modules/msgflo/src/coordinator.coffee:135:14
May 14 03:31:26 c-flo node[3134]:     at MessageBroker.Client._onMessage (/opt/c-flo/node_modules/msgflo-nodejs/lib/mqtt.js:165:22)
May 14 03:31:26 c-flo node[3134]:     at MqttClient.<anonymous> (/opt/c-flo/node_modules/msgflo-nodejs/lib/mqtt.js:58:26)
May 14 03:31:26 c-flo node[3134]:     at emitThree (events.js:116:13)
May 14 03:31:26 c-flo node[3134]:     at MqttClient.emit (events.js:197:7)
May 14 03:31:26 c-flo node[3134]:     at MqttClient._handlePublish (/opt/c-flo/node_modules/mqtt/lib/client.js:816:12)
May 14 03:31:26 c-flo node[3134]:     at MqttClient._handlePacket (/opt/c-flo/node_modules/mqtt/lib/client.js:286:12)
May 14 03:31:26 c-flo node[3134]:     at process (/opt/c-flo/node_modules/mqtt/lib/client.js:242:12)
May 14 03:31:26 c-flo node[3134]:     at Writable.writable._write (/opt/c-flo/node_modules/mqtt/lib/client.js:252:5)
May 14 03:31:26 c-flo node[3134]:     at doWrite (/opt/c-flo/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:338:64)
May 14 03:31:26 c-flo node[3134]:     at writeOrBuffer (/opt/c-flo/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:327:5)
May 14 03:31:26 c-flo node[3134]:     at Writable.write (/opt/c-flo/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:264:11)
May 14 03:31:26 c-flo node[3134]:     at Socket.ondata (_stream_readable.js:555:20)
May 14 03:31:26 c-flo node[3134]:     at emitOne (events.js:96:13)
May 14 03:31:26 c-flo node[3134]:     at Socket.emit (events.js:191:7)
May 14 03:31:26 c-flo node[3134]:     at readableAddChunk (_stream_readable.js:176:18)
May 14 03:31:26 c-flo node[3134]:     at Socket.Readable.push (_stream_readable.js:134:10)
May 14 03:31:26 c-flo node[3134]:     at TCP.onread (net.js:563:20)
May 14 03:31:26 c-flo node[3134]:
May 14 03:31:26 c-flo node[3134]:  {"command":"participant","protocol":"discovery","payload":{"component":"c-base/music-player","label":"Show URL on a public screen.","outports":[{"queue":"megablast/current_song","type":"object","description":"JSON object of the current song being played.","id":"current_song"}],"role":"megablast","id":"cdmmpqtt83779605327991","icon":"television"}}
@jonnor
Copy link
Member

jonnor commented May 16, 2017

This is not a crash, but the output of a warning due to the discovery message being malformed. Not a bug.

@jonnor jonnor added enhancement and removed bug labels May 16, 2017
@jonnor
Copy link
Member

jonnor commented May 16, 2017

But using a JSON schema here instead of basic validation would be nice, since then we would also validate actual values and not just their presence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants