cdimascio / express-openapi-validator

🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
MIT License
885 stars 203 forks source link

Server variables without enum don't get validated #889

Open yoelkohn opened 5 months ago

yoelkohn commented 5 months ago

Describe the bug If server variable is defined, with a default but no enum, per OpenAPI docs, it should allow any arbitrary value. This implementation, however, will create an enum array with the default value as its sole element, and ignore any value that doesn't match the default.

To Reproduce Create spec with

servers:
    -   url: /api/v0.1/t/{variableName}
        variables:
          variableName:
            default: blocked

then navigate to /api/v0.1/t/notBlocked

Actual behavior Path is completely ignored

Expected behavior Path should be validated