-
Notifications
You must be signed in to change notification settings - Fork 441
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: Fixes an Interface field argument regression #3112
fix: Fixes an Interface field argument regression #3112
Conversation
src/Type/WPInterfaceTrait.php
Outdated
return $type->name; | ||
} | ||
|
||
return ''; |
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.
Avoid too many return
statements within this method.
* | ||
* @return string | ||
*/ | ||
private function field_arg_type_to_string( $type ) { |
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.
Function field_arg_type_to_string
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
@kidunot89 is this addressing something different than #3109 or is it just a different approach? |
@kidunot89 this breaks most of the workflows: https://github.com/wp-graphql/wp-graphql/pull/3112/checks |
@jasonbahl @justlevine The breaking workflows are because of WPGraphQL TestCase. It should be resolved in the 3.0 release which I'm working on right now. I'll get it up and update the PR. |
Do we need update wp-graphql-test-case in a bugfix PR? Also, I'm still unclear how this differs in approach (or purpose?) to #3109 . I'm happy to give the same sort of code review (inline docs and reduced cyclomatic complexity), but it would be helpful to know what (if anything) I should be comparing. |
@kidunot89 ya, I think we should handle any updates needed for WPGraphQL Test Case separately. Let's focus on the specific issue at hand here, a regression to the merging of Interface Fields with Object Type fields. The other changes are creating side effects that maybe should ultimately be handled, but not within this PR. |
* | ||
* @return string | ||
*/ | ||
private function field_arg_type_to_string( $type ) { |
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.
Function field_arg_type_to_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
…rface-field-arg-regression-fix # Conflicts: # composer.lock
579f6e5
to
cc87110
Compare
src/Type/WPInterfaceTrait.php
Outdated
* | ||
* @return string | ||
*/ | ||
private function field_arg_type_to_string( $type ) { |
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.
Function field_arg_type_to_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
…rface-field-arg-regression-fix # Conflicts: # src/Type/WPInterfaceTrait.php # tests/wpunit/InterfaceTest.php
@kidunot89 I added another test to cover complex arg types, such as: 'args' => [
'nonNullableArg' => [
'type' => [ 'non_null' => 'String' ],
'defaultValue' => 'nonNullableArg',
],
'listOfArg' => [
'type' => [ 'list_of' => 'String' ],
'defaultValue' => [ 'listOfArg', 'listOfArg 2' ],
],
'nonNullListOfString' => [
'type' => [ 'non_null' => [ 'list_of' => 'String' ] ],
'defaultValue' => [ 'nonNullListOfString', 'nonNullListOfString 2' ],
],
'listOfNonNullString' => [
'type' => [ 'list_of' => [ 'non_null' => 'String' ] ],
'defaultValue' => [ 'listOfNonNullString', 'listOfNonNullString 2' ],
],
], |
Code Climate has analyzed commit dc959aa and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
@jasonbahl I'm going to open up a follow up PR to add some code quality improvements and add the failure cases |
@justlevine can you open the PR to the release branch and include updates to the changelogs as well? |
What does this implement/fix? Explain your changes.
This fixes a regression to #3102 / #3100
Does this close any currently open issues?
closes: #3108
Any other comments?
Given the following code:
Before
The schema would be invalid:
And this query would be invalid:
After
The schema loads as valid and the test field can be queried