Skip to content

Commit

Permalink
feat: Migrated api-platform deprecated http_cache configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Jul 24, 2023
1 parent be1031a commit 4177d05
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 40 deletions.
16 changes: 3 additions & 13 deletions config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,14 @@ api_platform:
versions: [3]
collection:
pagination:
items_per_page: 15 # Default value
maximum_items_per_page: 50
client_items_per_page: true
page_parameter_name: page
items_per_page_parameter_name: itemsPerPage

http_cache:
# Automatically generate etags for API responses.
etag: true
public: true
# Default value for the response max age.
max_age: '%env(int:HTTP_CACHE_MAX_AGE)%'
# Default value for the response shared (proxy) max age.
shared_max_age: '%env(int:HTTP_CACHE_SHARED_MAX_AGE)%'
# Default values of the "Vary" HTTP header.
vary: [ 'Accept', 'Authorization', 'Origin', 'Accept-Encoding', 'Content-Type' ]
# http_cache:
# invalidation:
# enabled: true
# varnish_urls: [ '%env(VARNISH_URL)%' ]

defaults:
enable_max_depth: true
normalization_context:
Expand Down
49 changes: 22 additions & 27 deletions lib/RoadizCoreBundle/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ api_platform:
show_webby: false
swagger:
versions: [3]
title: "My Roadiz website API"
description: "My Roadiz website API"
title: "%env(string:APP_TITLE)%"
description: "%env(string:APP_DESCRIPTION)%"
version: '%env(string:APP_VERSION)%'
mapping:
paths:
Expand All @@ -19,32 +19,27 @@ api_platform:
- '%kernel.project_dir%/vendor/roadiz/core-bundle/src/Entity'
- '%kernel.project_dir%/vendor/rezozero/tree-walker/src'
- '%kernel.project_dir%/config/api_resources'
# http_cache:
# # Automatically generate etags for API responses.
# etag: true
# public: true
# # Default value for the response max age.
# max_age: '%env(int:HTTP_CACHE_MAX_AGE)%'
# # Default value for the response shared (proxy) max age.
# shared_max_age: '%env(int:HTTP_CACHE_SHARED_MAX_AGE)%'
# # Default values of the "Vary" HTTP header.
# vary: ['Accept', 'Authorization', 'Origin', 'Accept-Encoding', 'Content-Type']
# invalidation:
# enabled: true
# varnish_urls: ['%env(VARNISH_URL)%']

collection:
pagination:
page_parameter_name: page
items_per_page_parameter_name: itemsPerPage

http_cache:
invalidation:
enabled: true
varnish_urls: [ '%env(VARNISH_URL)%' ]

defaults:
enable_max_depth: true
normalization_context:
skip_null_values: true
pagination_client_items_per_page: true
pagination_items_per_page: 15
pagination_maximum_items_per_page: 50
# cache_headers:
# etag: true
# public: true
# max_age: '%env(int:HTTP_CACHE_MAX_AGE)%'
# shared_max_age: '%env(int:HTTP_CACHE_SHARED_MAX_AGE)%'
# vary: ['Accept', 'Authorization', 'Origin', 'Accept-Encoding', 'Content-Type']
collection:
pagination:
items_per_page: 15 # Default value
maximum_items_per_page: 50
client_items_per_page: true
items_per_page_parameter_name: itemsPerPage
cache_headers:
etag: true
public: true
max_age: '%env(int:HTTP_CACHE_MAX_AGE)%'
shared_max_age: '%env(int:HTTP_CACHE_SHARED_MAX_AGE)%'
vary: [ 'Accept', 'Authorization', 'Origin', 'Accept-Encoding', 'Content-Type' ]

0 comments on commit 4177d05

Please sign in to comment.