knuckleswtf / knuckleswtf/scribe

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

Open
#384 5 comments 1 reaction 0 assignees View on GitHub
feature-request help wanted
Dominant language
PHP
Stars
2.3k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

- [x] I've read the [documentation](https://scribe.knuckles.wtf/laravel) 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.

Contributor guide

Open the contributing guide

Research direction

Start by locating GetFromResponseFieldTag and tracing how controller @responseField definitions are parsed, then inspect handling for @transformer, @transformerCollection, and includes. Done means response-field definitions from referenced transformers are included without requiring duplicate annotations on each API method.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.