Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Regexp pattern not escaped in JSON

Open provegard opened this issue 4 years ago • 1 comments

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.

provegard avatar Jun 04 '21 09:06 provegard

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] avatar Jul 08 '24 01:07 github-actions[bot]

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

github-actions[bot] avatar Jul 23 '24 01:07 github-actions[bot]