Skip to content

bug: exclude.paths is not working when using RegExp #275

Description

@marcalexiei

Description

exclude.paths are not working use RegEXp

Reproduction

Consider the following code

import Elysia from "elysia";
import openapi from "@elysiajs/openapi";

export const app = new Elysia()
  .use(
    openapi({
      exclude: {
        paths: [/^\/v1/],
      },
    })
  )
  .get("/", () => "index")
  .get("/v1", () => "v1")
  .get("/v1/foo", () => "v1")
  .get("/v2", () => "v2")
  .get("/v3", () => "v3")
  .listen(3000);
  1. Run the server
  2. Open http://localhost:3000/openapi
  3. Check the list of APIs in the page
Image

/v1/* entry points should not being listed

It seems that only plain string matching the exact API are working

Specs

  System:
    OS: macOS 26.0.1
    CPU: (8) arm64 Apple M3
    Memory: 426.36 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.9.0
    Yarn: 1.22.22 
    npm: 11.6.0 
    pnpm: 10.18.1
    bun: 1.2.23
  npmPackages:
    @elysiajs/openapi: ^1.4.11 => 1.4.11 
    elysia: latest => 1.4.9 

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions