domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.2k stars 1.29k forks source link

Regexp pattern not escaped in JSON #2133

Closed provegard closed 1 month ago

provegard commented 3 years ago

I have a property with the following attribute:

[RegularExpression("(?s)^[^\u0000-\u001f\\\\/*?<>|:\"]+$")]

Swashbuckle emits the following JSON:

"pattern": "(?s)^[^�-\\\\/*?<>|:\"]+$",
"type": "string"

Swagger-UI doesn't like this:

image

I tried NSwag as well, and it outputs:

"type": "string",
"minLength": 1,
"pattern": "(?s)^[^\u0000-\u001f\\\\/*?<>|:\"]+$"

...which Swagger-UI is happy with.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale.