Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental FileSystemProvider for API objects #257

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ghys
Copy link
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
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
Collaborator

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
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