Skip to content

Conversation

spawnia
Copy link
Collaborator

@spawnia spawnia commented Sep 19, 2019

Resolves #293

Equivalent to https://github.com/graphql/graphql-js/blob/master/src/utilities/buildClientSchema.js

@vladar is there something you wish to change about the implementation? I would do the tests next.

Copy link
Member

@vladar vladar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with this implementation. Feel free to continue!

@simPod
Copy link
Collaborator

simPod commented Oct 31, 2019

@spawnia out of curiosity, why did you decide to go with arrays (0f7d970)?

@spawnia
Copy link
Collaborator Author

spawnia commented Nov 1, 2019

@simPod it fit better with the rest of the library, which also uses associative arrays for other parts that interface with client code.

I prefer stdClass, as it is a clean distinction to sequential arrays, but still think that internal consistency of the project is more important than my personal preferences.

@vladar
Copy link
Member

vladar commented Nov 2, 2019

Cool, let me know when you finish.

@spawnia
Copy link
Collaborator Author

spawnia commented Nov 19, 2019

@vladar finished the implementation and test suite.

A few minor fixes in the rest of the library came up while implementing the whole test suite. No changes to other tests were required and i don't think there are breaking changes.

I stuck as close as possible to the reference implementation. There were 2 tests i had to skip, related to #567

@vladar
Copy link
Member

vladar commented Nov 20, 2019

Awesome, I'll do a full review as soon as I have a chance! Quick note - looks like style checks are failing

@spawnia
Copy link
Collaborator Author

spawnia commented Dec 6, 2019

@vladar everything is passing now apart from Scrutinizer complaining about the complexity of BuildClientSchema.

I think we should stick close to the reference implementation and keep the class as is. The error should go away once this is merged, right?

@simPod simPod force-pushed the master branch 2 times, most recently from 61b0907 to 8d37049 Compare December 14, 2019 12:33
# Conflicts:
#	composer.json
@vladar
Copy link
Member

vladar commented Dec 30, 2019

@spawnia Ignore scrutinizer, we'll remove it from our checks and just use PHPStan. I am ready to merge this but can you please resolve conflicts first?

@simPod
Copy link
Collaborator

simPod commented Dec 30, 2019

@vladar OT: I marked only Travis as a Required check few weeks ago.

@spawnia
Copy link
Collaborator Author

spawnia commented Jan 17, 2020

Finally, the pipeline succeeded. @vladar this should be good to go. I have been using this branch successfully in https://github.com/spawnia/sailor

/**
* @see BuildClientSchema
*/
class BuildClientSchemaTest extends TestCase
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final, should not be allowed to be extended

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am firmly opposed to the usage of the final keyword in libraries such as this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand there are people avoiding final but for tests there's no issue, hm? Consumers won't get affected anyway and we accidentally won't extend Tests nor they will get suggested in autocomplete.

@@ -272,9 +272,9 @@ public static function groupBy($traversable, callable $keyFn)
}

/**
* @param mixed[]|Traversable $traversable
* @param iterable $traversable
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed all related type hints in #613

@vladar
Copy link
Member

vladar commented Feb 26, 2020

Awesome! Thank you for this huge work. And sorry for being late to merge this - last two months were pretty intense for me.

@vladar vladar merged commit 21c5996 into webonyx:master Feb 26, 2020
@spawnia spawnia deleted the BuildClientSchema branch April 7, 2020 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can I build shema object from introspection string?
4 participants