-
-
Notifications
You must be signed in to change notification settings - Fork 34
Description
so in my generated openapi schema, i noticed that there was "/" surrounding my regex, which ends up rendering incorrectly in swagger-ui
i traced it to this line in the documentation builder in depictString.
express-zod-api/src/documentation-helpers.ts
Line 464 in c39f739
| result.pattern = `/${regex.source}/${regex.flags}`; |
so it uses the format /${regex.source}/${regex.flags}, however looking here: https://swagger.io/docs/specification/data-models/data-types/#pattern it seems that it just wants ${regex.source}, and oas3/3.1 does not support flags
https://262.ecma-international.org/5.1/#sec-15.10.1 it looks like bnf for regexp here does not include the wrapping / and flags
i think the right answer here is to just change this line to result.pattern = `${regex.source}` // result.pattern = regex.source ?