-
Notifications
You must be signed in to change notification settings - Fork 81
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
Invalid OpenAPI doc for route parameter with pattern #286
Comments
Hi @antipooh Everything that appears before the ":" in route parameters definition is intended to be used as additional information on the expected format of the route to match. The parameter name must be indeed what appears after the ":". Example, let's say that you define this route: @get("/api/cats/{cat_id}") In this case, the route matches any kind of ID, regardless of its format:
However, if you specify a route like this: @get("/api/cats/{uuid:cat_id}") You are instructing the framework to only match requests when the path contains a parameter matching the pattern of a UUID (also called GUID). Therefore, it will only match requests like this one:
This feature is described here: https://www.neoteroi.dev/blacksheep/routing/#value-patterns |
Fixed at a7b8f7a. |
Using route parameter with pattern, like
@get("{uuid:image_id}")
will generate the wrong parameter nameimage_id
in openapi.json method description and Swagger make bad parameter substitutions on method request. If manualy replaceimage_id
touuid:image_id
all work well.The text was updated successfully, but these errors were encountered: