eclipse-zenoh / zenoh-plugin-webserver

A zenoh plug-in implementing an HTTP server mapping URLs to zenoh paths. This plugin can be used to set-up a Web server where the resources are retrieved from geo-distributed zenoh storages, each leveraging various backends (file system, database, memory...)
Other
15 stars 12 forks source link

Add optional `__path__` and `__required__` fields in `Config` deserialization #25

Closed fuzzypixelz closed 9 months ago

fuzzypixelz commented 10 months ago

Fixes #19.

The issue stems from Config denying unknown fields such as __path__ and __required__. As this data is (currently) unused by Web Server, 'deserializing' it into serde::de::IgnoredAny is the most straightforward solution.

Note that other Zenoh plugins such as zenoh-plugin-dds do deserialize these fields, but IIUC they do not use them afterwards. If true, I will open a PR to mark them as IgnoredAny in all plugins.

JEnoch commented 9 months ago

Thanks for addressing this forgotten issue!

I think that even if not used yet, those fields can be useful, and at least displayed in the admin space. They shall be consistent with the description made in DEFAULT_CONFIG.json5 and with the code reading them in commons/zenoh-config/src/lib.rs. Thus, they shall be defined as such:

    __path__: Option<bool>,
    __required__: Option<Vec<String>>,

And I see their definitions are not consistent across plugins. See:

Could you please open PR for those ?