zazuko/kopflos

Providing base URI to Api Documentation

Opened this issue · 1 comments

The Api Documentation has to explicitly list endpoints for Express to hook up the router

A minimal document (excerpt) is like:

@base <http://localhost:9999/> .
@prefix hydra: <http://www.w3.org/ns/hydra/core#> .

api:Entrypoint a hydra:Class .

<> a api:Entrypoint .

The @base weird here as deploying to different environments will change the base URL. I propose that it is passed to the parser as a middleware parameter and skipped in the api doc graph:

return hydraBox.fromUrl('/api', 'file://' + path.join(__dirname, 'hydra/api.ttl'), {
  base: 'http://localhost:9999/',
})

While I notice that the @base does not affect the middleware itself, it's still weird to have those resources appear in wrong namespace in the ApiDocumenation resource