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
Fix custom operation_id's from OpenAPI #859
Conversation
|
Attached issue: https://pulp.plan.io/issues/7341 |
pulpcore/openapi/__init__.py
Outdated
| action_name = getattr(self.view, "action", self.method.lower()) | ||
| if action_name not in ["retrieve", "list", "destroy", "create"]: | ||
| return action_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking for customized action such as: sync and modify.
So if we get a customized action, we return it.
| if self.method.lower() == "get" and self._is_list_view(): | ||
| return "list" | ||
|
|
||
| return self.method_mapping[self.method.lower()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default actions are handled here
| tokenized_path = schema._tokenize_path() | ||
| tokenized_path = "_".join( | ||
| [t.replace("-", "_").replace("/", "_").lower() for t in tokenized_path] | ||
| ) | ||
| action = schema.get_operation_id_action() | ||
| if f"{tokenized_path}_{action}" == operation["operationId"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this assures to return only the action for the bindings.
rpm_rpm_repositories_list -> list
rpm_rpm_repositories_sync - > sync
| action = action_name.replace("destroy", "delete").replace("retrieve", "read") | ||
| tokenized_path = schema._tokenize_path() | ||
| tokenized_path = "_".join( | ||
| [t.replace("-", "_").replace("/", "_").lower() for t in tokenized_path] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if the docstrings I've added are enough or if I have to make an inline comment here
[noissue]
https://pulp.plan.io/issues/7341
closes #7341
Please be sure you have read our documentation on creating PRs:
https://docs.pulpproject.org/contributing/pull-request-walkthrough.html