Feat/consys custom formats - #354
Conversation
… schemas Extend the CustomObsFormat SPI with command-side hooks (getCommandBinding, getCommandSchemaBinding) and an isAutoSelectable flag, and thread the configured customFormats map through the obs, command, command-status, datastream-schema and command-stream-schema handlers so a registered format (e.g. application/swe+proto) can serve its own data and schema views.
… POST Dispatch datastream and control-stream creation to a registered custom format's binding when the embedded schema names it. DataStreamBindingJson gains a custom-format branch ahead of the application/swe+ prefix match; CommandStreamBindingJson buffers the schema object and dispatches on commandFormat, staying backward-compatible (a missing commandFormat still uses the default JSON binding); CommandStreamHandler threads the customFormats map through to the binding.
…es from alternate transports
94c17c0 to
706a2d3
Compare
alexrobin
left a comment
There was a problem hiding this comment.
Thanks for making progress on this. Overall it looks good, just a few minor changes
There was a problem hiding this comment.
I think we should probably create a dedicated CustomCommandFormat class instead of overloading this one.
| // param still takes precedence | ||
| var defaultFormat = ctx.getFormat() != null ? ctx.getFormat() : ResourceFormat.AUTO; | ||
| var responseFormat = parseFormat(queryParams, defaultFormat); | ||
| ctx.setFormatOptions(responseFormat, parseSelectArg(queryParams)); |
There was a problem hiding this comment.
Can you set the query param in the MQTT layer instead to avoid this special case?
| if (binding != null) | ||
| return binding; | ||
| } | ||
|
|
There was a problem hiding this comment.
Can you implement this as close as possible to what was done for obs (I see I created a getCustomFormatBinding method so we should do the same here.
| // (e.g. MQTT ":data/<format-token>" subtopics); an explicit f= query | ||
| // param still takes precedence | ||
| var defaultFormat = ctx.getFormat() != null ? ctx.getFormat() : ResourceFormat.AUTO; | ||
| var responseFormat = parseFormat(queryParams, defaultFormat); |
There was a problem hiding this comment.
Same as for obs: not sure we need this if the MQTT layer adds the proper query param in the context instead
There was a problem hiding this comment.
I think this class does not serialize the list of compatible custom formats so we should add that too (see DataStremBindingJson.serialize method that uses SWECommonUtils.getAvailableFormats())
This adds an extension for modules to add custom formats. In particular, swe+proto requires that other formats be exposed via the Connected Systems API module. See opensensorhub/osh-addons#224