cdimascio / express-openapi-validator

🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server variables without enum don't get validated

yoelkohn opened this issue · comments

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