Skip to content

Experimental FileSystemProvider for API objects#257

Draft
ghys wants to merge 1 commit into
openhab:mainfrom
ghys:fsprovider
Draft

Experimental FileSystemProvider for API objects#257
ghys wants to merge 1 commit into
openhab:mainfrom
ghys:fsprovider

Conversation

@ghys
Copy link
Copy Markdown
Member

@ghys ghys commented Apr 2, 2021

This is a proof-of-concept of an implementation of #248
providing a file system able to abstract items and rules
(only for now) in YAML files.

The items & things "files" can be opened from the Items
Explorer resp. Things Explorer in a new "Open in YAML"
context menu entry.

It also showcases how the YAML extension can be supplied
schemas with this API:
https://github.com/redhat-developer/vscode-yaml/wiki/Extension-API

The schema for the thing YAML is dynamic and queries the
thing type API to retrieve the config parameter descriptions.

Only simple read operations for items & things have been
implemented as a PoC but listing "directories", writing "files"
(deserializing the YAML and updating objects with the REST API),
and other operations like renaming (changing the UID) can also
be envisioned.

This would make VS Code a good alternative code-based UI to edit
objects in an instance (with additional comfort vs. the main UI
for heavy editing, like tabs etc.) while retaining the benefits
of the JSON DB.

Signed-off-by: Yannick Schaus github@schaus.net

This is a proof-of-concept of an implementation of openhab#248
providing a file system able to abstract items and rules
(only for now) in YAML files.

The items & things "files" can be opened from the Items
Explorer resp. Things Explorer in a new "Open in YAML"
context menu entry.

It also showcases how the YAML extension can be supplied
schemas with this API:
https://github.com/redhat-developer/vscode-yaml/wiki/Extension-API

The schema for the thing YAML is dynamic and queries the
thing type API to retrieve the config parameter descriptions.

Only simple read operations for items & things have been
implemented as a PoC but listing "directories", writing "files"
(deserializing the YAML and updating objects with the REST API),
and other operations like renaming (changing the UID) can also
be envisioned.

This would make VS Code a good alternative code-based UI to edit
objects in an instance (with additional comfort vs. the main UI
for heavy editing, like tabs etc.) while retaining the benefits
of the JSON DB.

Signed-off-by: Yannick Schaus <github@schaus.net>
@ghys
Copy link
Copy Markdown
Member Author

ghys commented Apr 2, 2021

Example: opening items & things from the explorer panes:

image

image

image

image

image

image

Example of generated schema from a thing type (incomplete):

image

@Confectrician
Copy link
Copy Markdown
Contributor

Did you make a global npm update?
Just wondering where the large package lock diff for the server package part is coming from.
Seems you didn't touch anything there.

@ghys
Copy link
Copy Markdown
Member Author

ghys commented Apr 3, 2021

For the server-side JS, I believe my version of npm has transformed the server side package-lock.json from version 1 to version 2. However, I seem not to have added dependencies so it could easily be kept as is.
For the client I added the yaml library as a dependency so there might be changes in the lock file, although they seem significant as well.
But this PR is in the pre-alpha stage anyway so there's time to adjust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants