Skip to content
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

feat: Add hint of which plugin is requesting specific decorator #2778

Merged
merged 1 commit into from
Jan 6, 2021
Merged

feat: Add hint of which plugin is requesting specific decorator #2778

merged 1 commit into from
Jan 6, 2021

Conversation

metcoder95
Copy link
Member

@metcoder95 metcoder95 commented Jan 5, 2021

Fixes #2760

The PR introduces now the name of the plugin that requests a specific decorator which is not available at the moment of registering the plugin. For now, only appends the name in the case that name exists.

For plugins that don't provide a name, the name cannot be printed. Assuming that the usage of the fastify-plugin is kinda mandatory, this shouldn't be an issue as it provides an auto-generated plugin name in case none is provided. In case this is not used, we depend on the handmade implementation by the developer.

We can always rely on the name property of the Function object but don't know how deep we want to go in that direction.

Any feedback is more than welcome!

Checklist

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina requested a review from jsumners January 5, 2021 17:40
Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I think this is probably the best effort we can make. At least with the way things are implemented. To go further, I think we would need to be able to inspect the passed in plugin itself to determine if it is a named function or not. But ultimately, people will pass in anonymous functions as plugins. So we can only go so far. The developer has to help themselves by providing information.

@mcollina mcollina merged commit af87e7b into fastify:master Jan 6, 2021
mcollina pushed a commit to fastify/fastify-plugin that referenced this pull request Feb 11, 2021
* chore(scripts): sort alphabetically ascending order

Sorted list should allow for quicker reference when looking at scripts

* ci(dependabot): auto update github actions

* docs(readme): add badges

* ci: ignore documentation updates

* ci: add parallel test coverage calculation

* test(test): update plugin error message

Changed in fastify/fastify#2778
@github-actions
Copy link

github-actions bot commented Feb 4, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report actual plugin requiring decorator
5 participants