Skip to content

[wip] feature: add openApi - #10

Open
tkurki wants to merge 1 commit into
mainfrom
openApi
Open

[wip] feature: add openApi#10
tkurki wants to merge 1 commit into
mainfrom
openApi

Conversation

@tkurki

@tkurki tkurki commented Oct 8, 2021

Copy link
Copy Markdown
Member

No description provided.

@dirkwa

dirkwa commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Worth recording why this could never have worked, in case anyone picks it up.

The server only called getOpenApi (and openApiPaths before it) for plugins mounting with registerWithRouter:

if (typeof plugin.registerWithRouter === 'function') {
  plugin.registerWithRouter(asPluginRouter(app, router, plugin.id))
  if (typeof plugin.getOpenApi === 'function') {
    app.setPluginOpenApi(plugin.id, plugin.getOpenApi())   // <- inside the branch
  }
}

This plugin mounts with signalKApiRoutes, because its routes belong under /signalk/v1/api rather than /plugins/tracks. So the description was silently dropped — no error, no log, just a 404 at /skServer/openapi/plugins/tracks and nothing in the Swagger UI.

Fix proposed in SignalK/signalk-server#3004, along with a doc comment for getOpenApi: the server fills in servers with /plugins/<id> when the document does not declare it, so a plugin mounting under /signalk/v1/api has to set servers itself.

Once that lands this becomes possible. Whether it is still wanted is a separate question — SignalK/signalk-server#2995 defines the track API server-side with its own OpenAPI description, and if that is the direction then this plugin becomes a provider behind it and has no routes of its own left to document. The v1 routes here would be the ones being superseded.

Either way the branch needs redoing rather than rebasing: it targets the module/ layout that no longer exists, uses the openApiPaths hook that has since been replaced, and documents an API without from/to/duration, times, isSelf or segmentation. Its bbox is also documented as west,south,east,north while the v1 routes actually parse lat,lon,lat,lon.

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