Skip to content

Cannot Use Multiple OpenAPI Middlewares #78

Description

@henry232323

There is no way to generate two separate OpenAPI specs for the app. For example:

const document1: OpenAPIV3.Document = {
  openapi: "3.1.0",
  info: {},
  paths: {},
  components: {
    schemas: {},
  },
  servers: [],
}

const document2: OpenAPIV3.Document = {
  openapi: "3.1.0",
  info: {},
  paths: {},
  components: {
    schemas: {},
  },
  servers: [],
}

export const oapi1 = openapi(document1)
export const oapi2 = openapi(document2)

app.use(document1)

app.get("/endpoint", oapi1.validPath({ ... }))
app.get("/other/endpoint", oapi2.validPath({ ... }))

The resulting openapi spec will include both /endpoint and /other/endpoint and their definitions, even though it was made with a separate middleware.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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