Skip to content

[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

Merged
merged 1 commit into from
May 20, 2021

Conversation

wizacedric
Copy link
Contributor

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.

@wizacedric
Copy link
Contributor Author

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:
Copy link
Contributor

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 👍🏻

Copy link
Contributor Author

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?

Copy link
Contributor

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

cc @nicolas-grekas

@Nyholm
Copy link
Member

Nyholm commented May 16, 2021

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:

Duplicate key "github" detected at line 15.

And with this PR the message changed to:

Duplicate key "github.client" detected at line 15.

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.

Copy link
Member

@nicolas-grekas nicolas-grekas left a 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

@carsonbot carsonbot changed the title Clarifying how to autowire scoped HTTP clients [HttpClient] Clarifying how to autowire scoped HTTP clients May 19, 2021
@javiereguiluz javiereguiluz added this to the 4.4 milestone May 20, 2021
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.
@javiereguiluz
Copy link
Member

Cédric, thanks for improving the docs ... and congrats on your first Symfony Docs contribution! 🎉

@javiereguiluz javiereguiluz merged commit 1e9f420 into symfony:4.4 May 20, 2021
@wizacedric wizacedric deleted the patch-1 branch May 21, 2021 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants