Skip to content

Commit

Permalink
Merge branch 'release/v2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed May 16, 2024
2 parents 28bd1bd + 65f8d1e commit 12259c9
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 115 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

All notable changes to Roadiz Doc will be documented in this file.

## [2.2.1](https://github.com/roadiz/docs/compare/v2.2.0...2.2.1) - 2024-02-27
## [2.3.0](https://github.com/roadiz/docs/compare/v2.2.1...v2.3.0) - 2024-05-16

### Features

- Upgrade `developer/troubleshooting.rst` - ([ebb5431](https://github.com/roadiz/docs/commit/ebb5431ce7ffcfe626e024bd6039f244e7dc67fd))
- Update new API platform resource config and WebResponse configuration - ([c5821b0](https://github.com/roadiz/docs/commit/c5821b0a96671dc3ef9d960a79aad5e42ffac643))

## [2.2.1](https://github.com/roadiz/docs/compare/v2.2.0...v2.2.1) - 2024-02-27

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Ambroise Maupate, Julien Blanchet
Copyright (c) 2024 Ambroise Maupate, Julien Blanchet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@
# built documents.
#
# The short X.Y version.
version = '2.2.1'
version = '2.3.0'
# The full version, including alpha/beta/rc tags.
release = '2.2.1'
release = '2.3.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
124 changes: 47 additions & 77 deletions src/developer/api/exposing_node_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,90 +5,60 @@ Exposing node-types

All resources configuration files are located in ``./config/api_resources`` folder.

Here is an example of API resource for a ``Page`` node-type, you'll find default ``operations``plus a special ``getByPath`` operation which allow overriding **WebResponse** serialization groups.
Here is an example of API resource for a ``Page`` node-type, you'll find default ``operations``.

.. code-block:: yaml
App\GeneratedEntity\NSPage:
types:
- Page
operations:
ApiPlatform\Metadata\GetCollection:
method: GET
shortName: Page
normalizationContext:
enable_max_depth: true
groups:
- nodes_sources_base
- nodes_sources_default
- urls
- tag_base
- translation_base
- document_display
- document_thumbnails
- document_display_sources
- nodes_sources_images
- nodes_sources_boolean
_api_page_archives:
method: GET
class: ApiPlatform\Metadata\GetCollection
shortName: Page
uriTemplate: /pages/archives
extraProperties:
archive_enabled: true
openapiContext:
summary: 'Retrieve all Page ressources archives months and years'
ApiPlatform\Metadata\Get:
method: GET
shortName: Page
normalizationContext:
groups:
- nodes_sources
- urls
- tag_base
- translation_base
- document_display
- document_thumbnails
- document_display_sources
- nodes_sources_images
- nodes_sources_boolean
getByPath:
method: GET
class: ApiPlatform\Metadata\Get
uriTemplate: /web_response_by_path
read: false
controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController
normalizationContext:
pagination_enabled: false
enable_max_depth: true
groups:
- nodes_sources
- node_listing
- urls
- tag_base
- translation_base
- document_display
- document_thumbnails
- document_display_sources
- nodes_sources_images
- nodes_sources_boolean
- web_response
- walker
- walker_level
- walker_metadata
- meta
- children
openapiContext:
tags:
- WebResponse
summary: 'Get a resource by its path wrapped in a WebResponse object'
description: 'Get a resource by its path wrapped in a WebResponse'
parameters:
- { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } }
resources:
App\GeneratedEntity\NSPage:
types:
- Page
operations:
ApiPlatform\Metadata\GetCollection:
method: GET
shortName: Page
normalizationContext:
enable_max_depth: true
groups:
- nodes_sources_base
- nodes_sources_default
- urls
- tag_base
- translation_base
- document_display
- document_thumbnails
- document_display_sources
- nodes_sources_images
- nodes_sources_boolean
_api_page_archives:
method: GET
class: ApiPlatform\Metadata\GetCollection
shortName: Page
uriTemplate: /pages/archives
extraProperties:
archive_enabled: true
openapiContext:
summary: 'Retrieve all Page ressources archives months and years'
ApiPlatform\Metadata\Get:
method: GET
shortName: Page
normalizationContext:
groups:
- nodes_sources
- urls
- tag_base
- translation_base
- document_display
- document_thumbnails
- document_display_sources
- nodes_sources_images
- nodes_sources_boolean
To automatically generate your resources YAML configuration files, execute the following CLI command:

.. code-block:: shell
bin/console generate:api-resources
If you manage your node-types from your back-office, new node-types configuration files will be generated automatically in the ``./config/api_resources`` folder.
137 changes: 107 additions & 30 deletions src/developer/api/web_response.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,82 @@ API will expose a WebResponse single item containing:
"hidingBlocks": false
}
Configure WebResponse endpoints
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

WebResponse endpoints are contextualized using their ``item`` type. For example, you can change any normalization context options according to your node-type. To achieve this, Roadiz call a dedicated controller for ``/web_response_by_path`` endpoint (``RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController``) and will look for a ``********_get_by_path`` operation name in your app to override ApiPlatform ``_api_operation`` and ``_api_operation_name`` request parameters.

If you manage your node-types from your back-office, new node-types web-response endpoints will be appended automatically to the ``config/api_resources/web_response.yaml`` folder. Only reachable node-types will be exposed.

Example of a ``WebResponse`` resource configuration in your ``config/api_resources/web_response.yaml`` configuration file containing two operations for ``blogpost`` and ``page`` node-types:

.. code-block:: yaml
resources:
App\Api\Model\WebResponse:
operations:
blogpost_get_by_path:
method: GET
class: ApiPlatform\Metadata\Get
uriTemplate: /web_response_by_path
read: false
controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController
normalizationContext:
pagination_enabled: false
enable_max_depth: true
groups:
- nodes_sources
- node_listing
- urls
- tag_base
- tag_parent
- translation_base
- document_display
- document_thumbnails
- document_display_sources
- nodes_sources_lien
- web_response
- walker
- children
openapiContext:
tags:
- WebResponse
summary: 'Get a resource by its path wrapped in a WebResponse object'
description: 'Get a resource by its path wrapped in a WebResponse'
parameters:
- { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } }
page_get_by_path:
method: GET
class: ApiPlatform\Metadata\Get
uriTemplate: /web_response_by_path
read: false
controller: RZ\Roadiz\CoreBundle\Api\Controller\GetWebResponseByPathController
normalizationContext:
pagination_enabled: false
enable_max_depth: true
groups:
- nodes_sources
- node_listing
- urls
- tag_base
- tag_parent
- translation_base
- document_display
- document_thumbnails
- document_display_sources
- nodes_sources_mise_en_forme
- nodes_sources_lien
- web_response
- walker
- children
openapiContext:
tags:
- WebResponse
summary: 'Get a resource by its path wrapped in a WebResponse object'
description: 'Get a resource by its path wrapped in a WebResponse'
parameters:
- { type: string, name: path, in: query, required: true, description: 'Resource path, or `/` for home page', schema: { type: string } }
Override WebResponse block walker
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -224,37 +300,38 @@ affect API performances.
For these common content, you can create a ``/api/common_content`` API endpoint in your project which will fetched only once in your
frontend application.

.. code-block:: yaml
# config/api_resources/common_content.yml
App\Api\Model\CommonContent:
operations:
getCommonContent:
class: ApiPlatform\Metadata\Get
method: 'GET'
uriTemplate: '/common_content'
read: false
controller: App\Controller\GetCommonContentController
pagination_enabled: false
normalizationContext:
enable_max_depth: true
.. code-block:: yaml
resources:
# config/api_resources/common_content.yml
App\Api\Model\CommonContent:
operations:
getCommonContent:
class: ApiPlatform\Metadata\Get
method: 'GET'
uriTemplate: '/common_content'
read: false
controller: App\Controller\GetCommonContentController
pagination_enabled: false
groups:
- get
- common_content
- web_response
- walker
- walker_level
- children
- children_count
- nodes_sources_base
- nodes_sources_default
- urls
- blocks_urls
- tag_base
- translation_base
- document_display
- document_folders
normalizationContext:
enable_max_depth: true
pagination_enabled: false
groups:
- get
- common_content
- web_response
- walker
- walker_level
- children
- children_count
- nodes_sources_base
- nodes_sources_default
- urls
- blocks_urls
- tag_base
- translation_base
- document_display
- document_folders
.. note::
Expand Down
2 changes: 1 addition & 1 deletion src/developer/documents-system/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ you must declare 3 storages:

Following example shows how to configure Flysystem to use *Scaleway* Object Storage (S3 compatible) service:

.. code-block:: yaml
.. code-block:: yaml
# config/packages/flysystem.yaml
# Read the documentation at https://github.com/thephpleague/flysystem-bundle/blob/master/docs/1-getting-started.md
Expand Down
4 changes: 3 additions & 1 deletion src/developer/first-steps/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ For new projects **Roadiz** can be easily setup using ``create-project`` command
# fit your development environment (OS, UID).
# .env file will be tracked by Git
#
# Customize docker-compose.yml file to set your stack name
#
# Initialize your Docker environment
docker-compose build
docker-compose up -d --force-recreate
Expand Down Expand Up @@ -64,7 +66,7 @@ Install database
# Create and migrate Roadiz database schema
docker-compose exec -u www-data app bin/console doctrine:migrations:migrate
# Migrate any existing data types
docker-compose exec -u www-data app bin/console app:migrate
docker-compose exec -u www-data app bin/console app:install
# Install base Roadiz fixtures, default translation, roles and settings
docker-compose exec -u www-data app bin/console install
# Stop workers to force restart them
Expand Down
10 changes: 8 additions & 2 deletions src/developer/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ these environments. As a first try, you should always call
``bin/console cache:clear;`` (replace *prod* by your environment)
in command line.

.. code-block:: shell
bin/console cache:clear --env=prod;
bin/console cache:pool:clear cache.global_clearer --env=prod;
Problem with entities and Doctrine cache?
-----------------------------------------

Expand All @@ -19,6 +24,7 @@ node-sources entity classes and upgrade database schema.

.. code-block:: shell
bin/console generate:nsentities;
bin/console doctrine:schema:update --dump-sql --force;
bin/console doctrine:migrations:migrate -n;
bin/console app:install -n;
bin/console cache:clear;
bin/console cache:pool:clear cache.global_clearer;

0 comments on commit 12259c9

Please sign in to comment.