-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mismatch behavior between RegexRouteConstraint and produced OpenApi document #2626
Comments
I am having the same issue in my .Net6 Framework app gives the following error
|
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. |
@StasPerekrestov or @SDOsmany. I have just tested using MyGet nuget and it seems to be working. |
@jgarciadelanoceda I suppose the issue can be closed. |
When a regex-based constraint is defined,
for instance
AlphaRouteConstraint is applied. The constraint inherits RegexRouteConstraint which is case insensitive.
The issue is that
RegexRouteConstraint.Constraint & RegexOptions.IgnoreCase
isn't taken into account.In a nutshell,
the behavior of
^[a-z]*$
is different in the OpenApi document and in AlphaRouteConstraint because the first one is case sensitive and the other one is case insensitive.This behavior can be observed in Swagger UI when it doesn't allow to execute an HTTP request due to a failed validation:
For instance, "Jack" cannot pass the provided regex constraint.
https://swagger.io/docs/specification/data-models/data-types/
The pattern keyword lets you define a regular expression template for the string value. Only the values that match this template will be accepted. The regular expression syntax used is from JavaScript (more specifically, ECMA 262). Regular expressions are case-sensitive, that is, [a-z] and [A-Z] are different expressions.
The text was updated successfully, but these errors were encountered: