-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add support for arguments description #623
Add support for arguments description #623
Conversation
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.
The only thing with this that somewhat concerns me is the potential to expose internals over your graph schema without knowing, and the inability to override any internal param comments through an attribute.
We'd have to modify the Field
attribute and add some nested array mess to overcome this, and that API wouldn't be pretty. I'm inclined to ignore this and assume that present docblock comments aren't going to contain sensitive information. But being that this will immediately expose additional comments over the schema, I think we need to consider this a BC break.
That's not a huge issue for the next release, as we already have some somewhat significant changes in master
.
Currently there is similar issue with the So maybe all this behaviour of taking description from docblocks should be improved in some future release all at once |
Agree. Should I mention it somewhere for future changelog? |
Pull up `getName` and `getDescription`
I think we can introduce configuration parameter aka "provide argument description" with default to "false", to provide a smooth upgrade path? |
Maybe going with a more explicit By disabling a global setting like this, you can also enforce descriptions being added to attributes, ensuring better schema documentation, as it'll always pertain to the API, and not to any internals. It's all a bit wonky, TBH. I don't like that we have output coming from so many places where it's not always inherently clear. |
@downace @andrew-demb did you guys have any thoughts on a global setting for using docblock descriptions? I'd like to see a PR for this and updated docs so we can include this in a new release. |
@oojacoboo But I can't provide a PR with docs in the next two weeks, sorry. |
@oojacoboo But I have some thoughts about using DocBlocks in generalUsing the DocBlocks is the most confusing thing for me in this lib. |
@downace I don't disagree. It would be great to have complete separation. Being that this lib was originally written with annotation support, prior to PHP attributes, this wasn't originally possible. Obviously that's changed now and it should be entirely possible. I'm not exactly sure what you mean by The only downside to full separation is doc/meta duplication. Of course, it would be entirely optional. I think it'd be great to include this global setting in conjunction with full attribute support, allowing you to entirely ignore docblocks. A combined PR for this would be awesome. |
I mean actual Pagination, using Porpaginas or Laravel Pagination. In our project we also implement the Connections spec.
Actually you're right, almost anything can be defined using attributes: // Simple list type
#[Query(outputType: '[Foo!]!')]
// Pagination
#[Query(outputType: 'PorpaginasResult_Foo')] But using type names instead of class names looks like an issue for me (not crutial, but still notable). It could be solved by allowing to use class names everywhere. Here's pretty rough example (hope the idea is clear): // Class name can be detected and converted into type name Foo the same way as for PHP type hints
#[Query(outputType: '[' . Foo::class . '!]!')]
// Same here, "generic" types and their arguments can be detected and converted into type names
#[Query(outputType: PorpaginasResult::class . '<' . Foo::class . '>')]
Global setting will give us two options:
Maybe it should be somehow overridable per attribute, like this: // Global useDocblockDescriptions = true, "blacklist mode"
/**
* Internal docs, should not be exposed
*/
#[Query(useDocblockDescription: false)]
// or
#[Query(description: 'API docs')] // Global useDocblockDescriptions = false, "whitelist mode"
/**
* Internal docs that matches the API docs, exposed explicitly
*/
#[Query(useDocblockDescription: true)] Anyway it's just some thoughts and ideas for future (if maintainers give it a greenlight), I'm not sure I could implement some of these myself soon. |
Fixes #622