Skip to content

options.htmlui no longer works for adding swagger docs #75

@dbevacqua

Description

@dbevacqua

According to the docs, should be able to pass options like this to enable swagger:

const oapi = openapi({
  openapi: '3.0.0',
  info: {
    title: 'Express Application',
    description: 'Generated docs from an Express api',
    version: '1.0.0',
  }
}, { htmlui: 'swagger-ui' } )

// This will serve the generated json document(s)
// (as well as the swagger-ui if configured)
app.use(oapi)

This worked in v0.3.0 but does not work since v1.1.0. The problem seems to be that middleware.swaggerui was changed to a function but its call site was not updated:

git grep middleware.swaggerui v1.1.0 -- index.js
v1.1.0:index.js:  middleware.swaggerui = (options) => ui.serveSwaggerUI(`${routePrefix}.json`, options)
v1.1.0:index.js:      router.use(`${routePrefix}/swagger-ui`, middleware.swaggerui)
git grep middleware.swaggerui v0.3.0 -- index.js
v0.3.0:index.js:  middleware.swaggerui = ui.serveSwaggerUI(`${routePrefix}.json`, opts)
v0.3.0:index.js:      router.use(`${routePrefix}/swagger-ui`, middleware.swaggerui)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions