fknop / hapi-pagination

Hapi plugin to handle "custom" pagination
MIT License
63 stars 35 forks source link

Joi validation issue with disabling pagination globally #77

Closed pasovsky closed 5 years ago

pasovsky commented 5 years ago

I'm using Glue and in the manifest I've added the options that are mentioned in the documentation. { plugin: 'hapi-pagination', options: { enabled: false, routes: { include: [] // Emptying include list will disable pagination } } }, This results in a joi validation error for "enabled" Looking at getConfig in config.js, the main config is validated against internals.schemas.options which doesn't have that field. The enabled field is in the internals.schemas.routeOptions schema, but if I understand correctly, this is checked for each individual route, but not globally.

fknop commented 5 years ago

Yes. Enabled is only available on route level if you want to disable or enable a route that is either included or excluded with the global include or exclude option. If you want to disable globally, an empty array for include should do.

fknop commented 5 years ago

I will fix the doc later today. Thanks for the report.