-
Notifications
You must be signed in to change notification settings - Fork 270
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
Non-unique operationId #137
Comments
fwiw, my frontend code generator https://github.com/cyclosproject/ng-openapi-gen renames the second one |
hey @jayvdb sry for the delay. a lot of stuff going on right now. to me it looks like it should be |
It isnt a rare case. I have hundreds of them. Almost every use of |
ok so lets take this apart real quick to not confuse the issues, because i see two separate ones here.
i meant that issue 1 is "usually" rare (but maybe not for oscar). of course issue 2 may be very common. |
This issue is about any and all dup operation id spec violations caused by path params. I'm not interested in discussion about splitting it into subsets. The cause is path params. Lots of apps have them. |
hmm, i get that the outcome is the same (operationId collision), but i have a hard time reasoning about possible fixes without having a look at the cases in detail. mainly because there is likely no magic bullet, at least it is not apparent to me at the moment. i think there are 3 types: 1: DRF's magic one could easily fix all 3 by simply encoding ALL path params into the operationId name, which will be quite ugly i suppose. Pretty sure that is not a good solution (e.g. |
Including path params to operation Id seems sane to me. They end up as method names in generated code, so it would be nice to keep them short and meaningful, and they must be stable otherwise changes will cause non-stable generated code. I refuse to have hashes in source code symbol names , so I do hope that isnt repeated , but I already have my own solution so I ultimately dont care what approach is taken.
|
ok i understand.
i was not aware of this. how and where do hashes get into the names? i would like to fix that. i did some improvement to |
enum class names. |
not sure how that can happen. in the operationId? is this a oscar thing? can you point me in the right direction there? just to make sure, you are not referring to the enum postprocessing hook. the names there are derived from either field name or manual name override. a field name with a |
|
Not sure if this is the exact same problem, but I encountered this warning:
Turns out I had two endpoints like this:
Each with a POST handler in different I simply fixed it using this decorator in one of the views: +from drf_spectacular.utils import extend_schema
def class SurveyAPIView(APIView):
...
+ @extend_schema(operation_id="some_unique_name_create")
def post(self, request, *args, **kwargs):
... Not sure if this is the proper way to address this issue but my schema is OK and the warning is gone. I hope this will help someone, I know it would've helped me. |
I have been experiencing the issue with |
@mattcousins that is certainly not the reason. The name resolution is not perfect. In the the rare case that a collision happens, it is recommended to resolve the issue via decorating one method with List detection is slightly different. Decorate |
Thanks for your reply, I understand that and can workaround. I was just saying I could reliably repeat a naming resolution issue so thought I would share with you in case it was helpful. |
The text was updated successfully, but these errors were encountered: