-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Asset] Allows to download asset manifest over HTTP #35762
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
GromNaN
commented
Feb 17, 2020
•
edited
Loading
edited
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
Deprecations? | no |
Tickets | Fix #35761 Fix #33001 |
License | MIT |
Doc PR | symfony/symfony-docs#13255 |
dfdc390
to
17cf357
Compare
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.
Please mind the CI.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
8e3c79b
to
b027a5c
Compare
This comment has been minimized.
This comment has been minimized.
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.
LGTM, here are some nitpicking.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/Tests/VersionStrategy/RemoteJsonManifestVersionStrategyTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/Tests/VersionStrategy/RemoteJsonManifestVersionStrategyTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
a82bbd7
to
aa997d7
Compare
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
bfd0141
to
10dd62a
Compare
…omponent tests (GromNaN) This PR was merged into the 3.4 branch. Discussion ---------- Use strict assertSame instead of assertEquals in Asset component tests | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | #35762 (comment) | License | MIT | Doc PR | N/A Using `assertSame` instead of `assertEquals` is recommended when possible (see sebastianbergmann/phpunit-documentation-english#3). It is stricter and must be more efficient ([`===`](https://github.com/sebastianbergmann/phpunit/blob/8.5.2/src/Framework/Constraint/IsIdentical.php#L63) vs a [comparator class](https://github.com/sebastianbergmann/phpunit/blob/8.5.2/src/Framework/Constraint/IsEqual.php#L79)). ~~Also, removing useless string cast.~~ Commits ------- e8f3e84 Use strict assertion in asset tests
c929d43
to
d517ee3
Compare
Let's improve the HttpClient component then!
|
d517ee3
to
1366b3b
Compare
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
…es (GromNaN) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [HttpClient][DX] Add URL context to JsonException messages | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #35762 (comment) | License | MIT | Doc PR | N/A In order to help when debugging incorrect JSON responses, this PR adds the requested URL to the error message. Before: `Syntax Error` After: `JSON error: Syntax error, from "https://example.com/file.json".` See the 2nd commit for full diff in new unit tests Commits ------- 0653917 [HttpClient][DX] Add URL context to JsonException messages
Absolutely, it needs to be cached. And the cache needs to be served in case of error. IMO this is the responsability of the HttpClient to handle this behavior. I'm trying to create a demo app to show the feature, but I don't find the correct config for |
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.
IMO this is the responsibility of the HttpClient to handle this behavior.
I'm not sure about that: there are many benefits in using CacheInterface
that won't be achieved by a CachingHttpClient
(sharing of the cache, lock while fetching, probabilistic expiration, etc).
But this could be handled in a separate PR that adds a generic CachedManifestVersionStrategy
, so that both ways are possible in the end.
Which means I'm good here, whith one last comment.
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
b6b5d59
to
7e45e6e
Compare
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 simplified the code to the simplest form. The CachedManifestVersionStrategy
is a clever idea that would solve performance and high availability issues. I can work on it once this PR gets merged.
Commits has been squashed & rebased.
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php
Outdated
Show resolved
Hide resolved
7e45e6e
to
cc7f039
Compare
Handle URL in json_manifest_path Download the manifest using the HttpClient
cc7f039
to
4ba12a8
Compare
Anyone else @symfony/mergers? |
I like this. Practical question: how could/should someone add caching? Decorate the service? Something else? There just needs to be a reasonable way and it's ok if it's simply covered in the docs. |
@weaverryan check #35762 (review) |
Thank you @GromNaN. |
@GromNaN would you like to give |
I'll open a PR today. |
This PR was squashed before being merged into the master branch. Discussion ---------- [Asset] Document remote JSON manifest Documentation for symfony/symfony#35762 - New feature for Asset component - Integration in FrameworkBundle configuration Commits ------- be4760c [Asset] Document remote JSON manifest