-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[HttpClient] Clarifying how to autowire scoped HTTP clients #15330
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
Conversation
I don't understand how to fix the CI. The original YAML already had duplicated keys. |
@@ -215,7 +215,7 @@ autoconfigure the HTTP client based on the requested URL: | |||
http_client: | |||
scoped_clients: | |||
# only requests matching scope will use these options | |||
github: | |||
github.client: |
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.
github_client:
Works the same 👍🏻
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.
@OskarStark I'm not sure what you mean? Do you think I should rename all github.client
as github_client
? What is the point?
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.
I see yaml keys more often with underscores. Sure github.client works fine, not sure what to promote
We test run the config block in a real application. If a user just copy/paste they will get that error "duplicate keys" etc.. The reason you see the error here is because the error message changed. Ie the "baseline" included config like:
And with this PR the message changed to:
Since the error is different from the baseline, we think it is a new one and we show it. You dont need to fix this issue, it is fine merging this PR with Code Blocks failing. |
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.
Dots are more common in service ids
The documentation didn't make it very clear that the key of the "scoped_clients" array was the actual service name that could be used to autowire the service. By using the same name in the code example and in the paragraph about autowiring, that should be clearer to the reader.
Cédric, thanks for improving the docs ... and congrats on your first Symfony Docs contribution! 🎉 |
The documentation didn't make it very clear that the key of the "scoped_clients" array was the actual service name that could be used to autowire the service. By using the same name in the code example and in the paragraph about autowiring, that should be clearer to the reader.