scribe icon indicating copy to clipboard operation
scribe copied to clipboard

[Feature] Add support to `GetFromResponseFieldTag` for transformers and includes

Open robbieaverill opened this issue 3 years ago • 5 comments

  • [x] I've read the documentation and I can't find details on how to achieve this.

When documenting an API, we can use @responseField to document various response parameters. This currently only works when defined directly on controllers.

It would be nice if it could parse various transformer tags (@transformer and @transformerCollection), and include @responseField definitions from them as well, e.g. @transformer \App\MyTransformer. This would be useful for a scenario where you have many API methods that all use the same transformer, so you won't need to copy and paste the @responseField annotations for every method.

robbieaverill avatar Dec 07 '21 19:12 robbieaverill

For now I've ported this commit over into userland code: https://github.com/ScopeyNZ/laravel-apidoc-generator/commit/886ac9dcc449ae3209b8624c4427448f24cf0c03

robbieaverill avatar Dec 07 '21 22:12 robbieaverill

You mean, @responseField annotations in the transformer class' docblock? Yeah, I guess we could support that.🤔

ScopeyNZ/laravel-apidoc-generator@886ac9d

You're still on laravel-apidoc-generator? Interesting.😄

shalvah avatar Dec 08 '21 07:12 shalvah

It would have to be via a user PR, though. I;m not big on the transformer aspect of things.

shalvah avatar Dec 08 '21 07:12 shalvah

Yeah we are migrating. Fair enough!

robbieaverill avatar Dec 08 '21 09:12 robbieaverill

I just committed a similar question with a detailed description. https://github.com/knuckleswtf/scribe/issues/596

marfrede avatar Jan 04 '23 16:01 marfrede