SignalK / artemis-server

signalk-java-server reloaded.
Apache License 2.0
2 stars 7 forks source link

Schema Integration #1

Open mkattnerBSB opened 5 years ago

mkattnerBSB commented 5 years ago

Hey guys,

we are developing something pretty new for the marine sector. And we want to rely on signal k.

I just had a look to your source code. I like the way you did it.

But I couldn't find a full schema integrating. Are you doing it by hand, or ist there a automatic way to read it from the json files of the specification repository? Do you have a roadmap?

Best, Martin

rob42 commented 5 years ago

Thanks, there are some improvements coming too, but I'm still finishing an edge case. The new version makes it easy to react to signalk keys and value changes, or to generate synthetic keys from real data - eg true wind from apparent wind.

'full schema integrating' - not sure what you mean. I'm deliberately using unstructured json (maps etc) as signalk both develops fast, and allows for arbitrary extension. Ive used jackson to reverse the schema to java pojos for the swagger docs, and tried the full schema too. Jackson didnt create nice pojos, so I canned that.

Roadmap is in my head!. Basically first goal is full signalk schema compliance with swagger docs for REST apis etc. Multi-vessel, horizontally scale-able. Nearly there. Second - fine-grained security (RBAC) down to the individual key level - the basics are there Third - full history with analysis. - the basics are there More:

But its a lot of work. Extra hands are always welcome.

mkattner commented 5 years ago

"...swagger docs, and tried the full schema too. Jackson didnt create nice pojos"

The signalk schema files are json schemas in version draft-04. Right? And no swagger docs.

As Jackson and the other POJO generators didn't work well, I wrote a simple own pojo generator. Have a look to the attachment: eclipse_2018-11-22_14-06-03

Deserializing with Jackosn: {"vessels":{"self":{"sensors":{"mastRotation":{"sensorData":"180"}}}}}

Creates a nice SignalK Pojo Instance.

And serializing with Jackson results in: {"vessels":{"self":{"sensors":{"mastRotation":{"sensorData":"180"}}}}}

Pojo Generation is 85% done and it works for my needs. I'll update it as soon as the first problems are araising.

If you want I can share the pojos with you ;-)

rob42 commented 5 years ago

ooh nice :-) Thats much better than the jackson version: image If you can contribute that would be appreciated.

Due to the dynamic nature of signalk I wont change the current handling in artemis, but your code would be great for swagger docs, test suites and signalk spec compliance checking which is a priority for us.

BTW the swagger docs are generated on the fly in the artemis server, so they are not in the spec yet.

rob42 commented 5 years ago

Did some design docs https://github.com/SignalK/artemis-server/blob/master/design/design.md