ad-on-is / adonis-autoswagger

Auto-Generate swagger docs for AdonisJS
MIT License
129 stars 41 forks source link

Ignore config seems to match anything even without wildcard [adonis v6] #111

Closed lckrugel closed 4 months ago

lckrugel commented 4 months ago

I am having an issue with how the match for the ignored routes config is working.

I'm trying to make it ignore the route path '/' by setting the ignore in swagger.ts as:

{
    "ignore": ["/docs", "/swagger", "/"],
}

However, by doing that it ignores every other route, wich seems odd as I'm not using any wildcard after.

I've tried changing the server watch mode from --hmr to the legacy --watch, but that didn't seem to make any difference.

Package versions:

{
  "@adonisjs/core": "^6.12.1",
  "adonis-autoswagger": "^3.57.0"
}

debug output (setup with a barebones application):

Found interfaces files [ 'D:\\Projetos\\test\\app/interfaces/i_hello_world.ts' ]
Model paths don't exist D:\Projetos\test\app\Models D:\Projetos\test\app/models
Validators paths don't exist D:\Projetos\test\app/validators
{
  snakeCase: true,
  preferredPutPatch: 'PUT',
  debug: true,
  path: 'D:\\Projetos\\test\\config/../',
  tagIndex: 1,
  info: {
    title: 'Test API',
    version: '0.0.0',
    description: 'API documentation'
  },
  ignore: [ '/swagger', '/docs', '/' ],
  common: { parameters: {}, headers: {} },
  securitySchemes: {},
  authMiddlewares: [ 'auth', 'auth:api' ],
  defaultSecurityScheme: 'BearerAuth',
  persistAuthorization: true,
  showFullPath: true,
  appPath: 'D:\\Projetos\\test\\config/../app'
}
Found Schemas [ 'Any', 'PaginationMeta', 'IHelloWorld' ]
Using custom paths {
  '#controllers': 'app/controllers',
  '#exceptions': 'app/exceptions',
  '#models': 'app/models',
  '#interfaces': 'app/interfaces',
  '#mails': 'app/mails',
  '#services': 'app/services',
  '#listeners': 'app/listeners',
  '#events': 'app/events',
  '#middleware': 'app/middleware',
  '#validators': 'app/validators',
  '#providers': 'providers',
  '#policies': 'app/policies',
  '#abilities': 'app/abilities',
  '#database': 'database',
  '#start': 'start',
  '#tests': 'tests',
  '#config': 'config'
}
Route annotations:
-----

Did I get anything wrong from the documentation? I've done this on another project with Adonis v5, albeit on a much older package version (1.8.1), and it worked fine

EDIT: created a repo with a project as example: barebones_adonis6

ad-on-is commented 4 months ago

Thx for the detailed description... Fixed in 3.58.0