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
Extend directive command to allow choosing interfaces #1251
Extend directive command to allow choosing interfaces #1251
Conversation
Really great effort. I think it needs some polish in terms of formatting, the overall design is sound. In terms of testing, it might be a good idea to isolate a pure functional core of this command that does not write to the filesystem. There is quite a lot of functionality in there. Even testing some smaller functions might help. Ping me once you think it is ready for another review. Don't worry about formatting too much, i will make a final pass over the PR anywas. |
# Conflicts: # docs/master/api-reference/commands.md
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.
Just tried it out in https://github.com/nuwave/lighthouse-example, works great.
I don't mind the lack of tests that much, developers will notice soon if things do not work out. Thank you and great job 👍
Continuation of #1240; adds extensive options for implementing methods and interfaces belonging to directive types.
Changes
The
lighthouse:directive
command now takes the--type
,--field
and--argument
options to implement the respective interfaces when creating a directive. The method stubs and imports are correctly created.Writing tests for generators has proven to be quite difficult, as you can't really mock the Filesystem API used by the base
GeneratorCommand
, so you'd be spamming generated directives throughout your code. However, I have ran the command lots of times with varying options and so far it has not yet given invalid PHP code. For reference, an empty directive generated by the command looks like this:And a directive with all options enabled results in this:
Click to expand
Breaking changes
None 😄