-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Custom metadata strategy data not available in language templates #380
Comments
Yes, This seems to be a useful feature, so I'm willing to accept a PR to add support for that. On the other hand, if you want a workaround, your custom strategy is also given an instance of the class MyCustomMetadata extends Metadata
{
public $custom = false;
}
class CustomMetadataStrategy extends MetadataStrategy
{
public function __invoke(ExtractedEndpointData $endpointData, array $routeRules): array
{
$endpointData->metadata = new MyCustomMetadata($endpointData->metadata->toArray());
$endpointData->metadata->custom = true;
}
} A simpler, but dirtier approach (which may not work): class CustomMetadataStrategy extends MetadataStrategy
{
public function __invoke(ExtractedEndpointData $endpointData, array $routeRules): array
{
// PHP (for now) allows you to add arbitrary properties to any object
$endpointData->metadata->custom = true;
}
} But, yeah, PRs welcome. It would be a simple fix: add a |
Thanks @shalvah, the laravel-apidoc-generator package supported this so I had assumed it was a bug, I will make a PR to add it though. |
It was supported by accident in previous versions of this package, where the |
What happened?
php artisan scribe:generate
I expect to see
customMetadata: true
in the dumped endpoint metadata, however it's not there:My environment:
php -v
): 8.0.5composer show laravel/framework
orcomposer show laravel/lumen-framework
): v8.74.0composer show knuckleswtf/scribe
): 3.18.0My Scribe config (minus the comments):
Additional info:
This is with a vanilla Laravel installation and one controller method:
The text was updated successfully, but these errors were encountered: