thclark/cpplot

Validate schema compliance at generation time

Opened this issue · 0 comments

Plotly provides a JSONSchema for graph objects which, assuming the schema is correct, should guarantee that the output is renderable.

Currently, production of figures can be hit-and-miss, since the outgoing JSON is not validated against the schema. If there is an error in production of the graph, there will be no way of knowing this until it's rendered (or not) and no meaningful information about why; unless you also know enough about javascript to be introspecting the errors on display-side.

Addition of a validate option would enable users to check that their JSON is plotly-compliant against the schema as the JSON is generated, as opposed to some time later when it's viewed; and create reasonable-looking error messages in the event of non-compliance.

I don't believe it's possible to do this at compile-time whilst still supporting modern features of C++.