-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
[superceded by #1361] Add Resources
path handling for those detailed in Signal K spec
#1352
Conversation
Resesources
path handling for the those detailed in Signal K specResources
path handling for those detailed in Signal K spec
Added
Operation:
|
@tkurki Should the resources API display in |
I don't think this is something I'd want on the dashboard. I'd imagine this is something you set up every once in a while, not something you'd check on the dashboard. Maybe a section under the plugin list in Plugin Config? Or under each plugin entry in the list, grey out if the the pluing is not enabled? |
@tkurki @sbender9 Looking for advice..... as this PR currently stands a PUT to a resource path {
value: { <resource data> }
} This aligns with the current PUT requirement as per the spec. {
name: 'route name',
description: 'route description,
distance: 80000,
feature { ... }
} So the question I have is ....... Given that the current PUT implementation does not service the The impact to the end user would be that an updated version of |
Well, that question is: do we break in new APIs from "the data is actually in the value field" and "PUT is for actions" and use PUT and POST the way they are usually used in REST APIs. I think we have sort of painted ourselves in a corner with the full model, that necessitates the To be honest I'd rather make a clear distinction between the old and new/revamped APIs and shed the baggage that we have there. Even if we'd have to start building v2 piecemeal. |
So is this PR going to result in an organised new way for plugins to register serving |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a bit of reading here and commented here and there.
Please format with npm run lint
. There's nothing here that is not auto-fixable, so CI lint is not complaining...need to fix that so that it does not succeed if there's stuff to fix.
Resources
path handling for those detailed in Signal K specResources
path handling for those detailed in Signal K spec
Reorganise typings to reuse some of the existings types.
Resources
path handling for those detailed in Signal K specResources
path handling for those detailed in Signal K spec
Supersceded by #1361 |
This branch adds path handling for
routes
,waypoints
,notes
,regions
andcharts
for the following operations mimicking currentsk-resources-fs
plug-in functionality to start addressing #1351 :Additionally it defines APIs for the creation, and updating of resources removing the need for the client to understand the resource schema.
These APIs are found at the following path
/signalk/v1/api/resources/set/<resource_type>
Operation:
In it's current form this PR instantiates middleware for the
/signalk/v1/api/resources
and/signalk/v1/api/resources/*
paths.When a path is accessed it checks if a provider has been registered for the resource type and:
next()
This mode of operartion ensures backward compatibility with exisiting plugins.
The registered resource provider plugin is responsible for the storage and retrieval of resource data, including filtering returned resources based on the supplied parameters.
This architecture allows for resource persistance to be tailored to the implementation requirements, either in the file system, a database service, cloud service, etc.
Server Resource API exposes the following methods to plugins:
Resource providers:
These are plugins that implement the following interface:
The methods will be called for each resource type listed in the
types
array.Each method returns a Promise which is
resolved
if successful and arejected
if unsuccessful.