express-openapi-validator icon indicating copy to clipboard operation
express-openapi-validator copied to clipboard

Add support for user-defined keywords

Open constanzaderienzo opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. Given our business logic, we are in need of adding custom-keywords.

For example:

in: path
name: offset
schema:
    type: number
    myUserKeyword: true # Custom keyword

We found that AJV has this feature: https://ajv.js.org/guide/user-keywords.html#user-defined-keywords.

However, there is no way to extend the Ajv instance used by the validator (or at least we couldn't find one).

Describe the solution you'd like Support for custom-keywords.

A solution is provided in this PR

constanzaderienzo avatar Jun 10 '24 16:06 constanzaderienzo

@constanzaderienzo can you describe the current behavior today and the desired behavior if this change were implemented and merged?

cdimascio avatar Sep 06 '24 19:09 cdimascio

Hi @cdimascio, we have the similar issue. We would like to keep the specification as single source of truth, to avoid drift between the specification and initial code implementation. And keywords look like the perfect solution for that.

vorobeybird avatar Mar 24 '25 16:03 vorobeybird