Skip to content
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

refactor: wrap AbstractConnectionResolver::is_valid_model() in ::get_is_valid_model() #3120

Merged
merged 2 commits into from
May 8, 2024

Conversation

justlevine
Copy link
Collaborator

What does this implement/fix? Explain your changes.

This PR adds the new AbstractConnectionResolver::get_is_valid_model() method, which wraps the ::is_valid_model() logic in the new graphql_connection_is_valid_model filter.

This filter is useful for developers who wish to override a Connection Resolver's is_valid_model() check. The separation of concerns helps those extending a Connection Resolver by minimizing the about of boilerplate they need to copy when overloading is_valid_model() in their child classes.

This is a non-breaking change.

Additionally, the spacing in some docblocks was cleaned up.

Does this close any currently open issues?

There are no breaking changes in this PR.

Any relevant logs, error output, GraphiQL screenshots, etc?

Any other comments?

Part of #2749

Where has this been tested?

Operating System: Ubuntu 20.04 (wsl2 + devilbox + php 8.1.15)

WordPress Version: 6.5.2

Copy link

codeclimate bot commented May 4, 2024

Code Climate has analyzed commit 1d084e8 and detected 0 issues on this pull request.

View more on Code Climate.

@justlevine justlevine added Type: Enhancement New feature or request Status: In Review Needs to be reviewed by a project maintainer before merge Needs: Reviewer Response This needs the attention of a codeowner or maintainer. Component: Connections Issues related to connections scope: API Issues related to access functions, actions, and filters labels May 4, 2024
@justlevine justlevine requested a review from jasonbahl May 4, 2024 01:14
@coveralls
Copy link

Coverage Status

coverage: 84.332% (+0.002%) from 84.33%
when pulling 1d084e8 on justlevine:feat/get_is_valid_model
into cb18964 on wp-graphql:develop.

@jasonbahl jasonbahl merged commit 4494f9e into wp-graphql:develop May 8, 2024
30 checks passed
@justlevine justlevine deleted the feat/get_is_valid_model branch May 8, 2024 15:47
@jasonbahl jasonbahl mentioned this pull request May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Connections Issues related to connections Needs: Reviewer Response This needs the attention of a codeowner or maintainer. scope: API Issues related to access functions, actions, and filters Status: In Review Needs to be reviewed by a project maintainer before merge Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants