-
Notifications
You must be signed in to change notification settings - Fork 211
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
Derived OpenAPI Docs in 5.x+ generates incorrect method call for swagger ui when function name is the same across two crates #1190
Comments
IIRC the doc says the function names have to be unique because they are used as the We might be able to prefix the Still the best solution is to have unique function names. |
Yup, Probably Swagger UI has worked before but since then and at least those latest versions are using |
I agree it cannot know about other crates, but adding the module name into the operationid as a prefix would greatly reduce collisions, we can't be the only people who version APIs this way |
While prepending the |
I think the issue should be solved by having the Or just to have a possibility to do that on the nested router, maybe something like this:
I admit that having to set |
juhaku Will you implement this .with_added_tag("one"), it was really cool! |
Note, this worked fine in 4.x but is now broken in 5.x+
Essentially, if you have two functions with the same name in different crates annotated with different paths, for example:
#[derive(OpenApi)] #[openapi( paths( v3::get_projects, v2::get_projects, ) )]
Then in the generated swagger docs page the invoked URL path for the V3 method will be wrong. What happens will be that the method will invoke the V2 path instead of V3. V2 will work as expected.
Both the generated Curl and RequestUrl values are also wrong (see screenshot)
Where despite being in the V3 section, the value are wrong (and in this case the example has only returned two elements in the list as for our simple test case, v2 returns two things and v3 should return 3).
Link to the testcase is here
Update:
When comparing the generated openapi.json between 4.x and 5.x they are identical (beyond the version number)
openapi-4.2.json
openapi-5.2.json
Would this indicate an issue with swagger?
The text was updated successfully, but these errors were encountered: