-
Notifications
You must be signed in to change notification settings - Fork 53
feat+refactor: log call site of deprecated Link rather than definition [+] #659
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
base: master
Are you sure you want to change the base?
Conversation
| return { | ||
| # to be verified if needed, since the models are dynamically created | ||
| "invenio_db.model": [ | ||
| "mock_module_factory = tests.mock_module_factory.grant", |
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.
didn't exist and not needed.
| assert rec_type.resource_config_cls.url_prefix == "/resourcetests" | ||
| assert rec_type.resource_config_cls.blueprint_name == "resourcetest" | ||
|
|
||
| # links_schema_class = rec_type.resource_config_cls.links_config["record"] |
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.
below tests that links_item and links_search setup. Then, all tests that use the service validate that the defined links work (they fail in response serialization like .data otherwise).
| "Link is deprecated and will be removed in v14.0. Use `ExternalLink` for " | ||
| "third-party links and `EndpointLink` for InvenioRDM links.", | ||
| DeprecationWarning, | ||
| stacklevel=2, |
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 is the important bit.
ae09429 to
dfe0840
Compare
- This keeps same interface, simply moves away from deprecated approach - Makes DeprecationWarning log where deprecated Link is *used* (useful) rather than where the warning call is defined (not so useful)
dfe0840 to
2dba88a
Compare
| "links_search": pagination_links("{+api}" + route + "{?args*}"), | ||
| "links_search": pagination_endpoint_links( | ||
| f"{self.record_name_lower}.search" | ||
| ), |
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 actually alters URL encoding which could cause tests in other repos to fail e.g., https://github.com/inveniosoftware/invenio-vocabularies/pull/517/files#r2556476359 . I am submitting PRs that fix those, so it will just be a matter of merging them when this one is merged and released.
2232aee to
07a4484
Compare
|
Ok this is ready for review with passing tests now. |
rather than where the warning call is defined (not so useful). This will highlight where Link is still used in other module tests, so that move to EndpointLink/ExternalLink can be done. For example, tests of invenio-drafts-resources using this updated module will log:
telling us that invenio-users-resources uses deprecated Link in
users/config.py:214.