flexiblepower / s2-ws-json

A WebSockets and JSON based protocol specification implementing the EN50491-12-2 "S2" standard for home and building energy management
Apache License 2.0
25 stars 2 forks source link

Broken spec? #13

Open 3nigm4 opened 10 months ago

3nigm4 commented 10 months ago

I tried multiple generators (https://github.com/asyncapi/nodejs-ws-template#cli and https://github.com/pearmaster/asyncapi-codegen) to generate the async-api. I just cloned this repo and tried to generate the s2-rm.yaml from the s2-asyncapi folder. The generators all failed. I think you miss "type: string" before the currency enum.

It would be nice if you could add instructions to the readme on how you generate the code from your end so that people know how the spec was tested.

wilcowijbrandi commented 9 months ago

Hi, thanks for taking an interest in S2!

Although AsyncAPI seems the best fit for what we want to specify here (JSON messages over a WebSocket), we've noticed that the OpenAPI specification itself is still being changed quite often and that the code generators are not yet of a very high quality. That is why we ourselves work with the JSON Schema's or even the OpenAPI specification (and ignore the REST stuff and implement the WebSocket ourselves), since they are much more mature.

The easiest way to get started is to use the s2-python module... if you're planning to use Python. For other programming languages I would advise you to start with JSON Schema.

Having said that, I agree the README and the OpenAPI specification can be improved. I'll keep this issue open until these points are addressed.

Also don't forget to check out the s2-analyzer project.

Cheers, Wilco