Skip to content

Commit 65ff599

Browse files
authored
Merge branch '3.1' into merge-3.0
2 parents fd598fc + 77d337b commit 65ff599

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+644
-904
lines changed

.github/workflows/cd.yml

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,57 @@ name: Deploy Website
33
on:
44
push:
55
branches:
6-
- main
7-
- '*.*'
6+
- main
7+
- '*.*'
88

99
jobs:
1010
deploy:
1111
runs-on: ubuntu-latest
1212
steps:
13-
14-
- name: Checkout the website
15-
uses: actions/checkout@v2
16-
with:
17-
repository: api-platform/website
18-
ref: main
19-
20-
- name: Get yarn cache directory path
21-
id: yarn-cache-dir-path
22-
run: echo "::set-output name=dir::$(yarn cache dir)"
23-
24-
- uses: actions/cache@v2
25-
id: yarn-cache
26-
with:
27-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-yarn-
31-
32-
- name: Install deps
33-
run: yarn install
34-
35-
- name: Retrieve docs
36-
run: bin/retrieve-documentation
37-
38-
- name: Build website
39-
env:
40-
GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
41-
run: yarn gatsby build
42-
43-
- name: Deploy
44-
uses: peaceiris/actions-gh-pages@v3
45-
with:
46-
github_token: ${{ secrets.GITHUB_TOKEN }}
47-
publish_dir: ./public
48-
cname: api-platform.com
13+
- name: Checkout the website
14+
uses: actions/checkout@v3
15+
with:
16+
repository: api-platform/website
17+
ref: main
18+
19+
- name: Get yarn cache directory path
20+
id: yarn-cache-dir-path
21+
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
22+
23+
- uses: actions/cache@v3
24+
id: yarn-cache
25+
with:
26+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
27+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-yarn-
30+
31+
- name: Install deps
32+
run: yarn install
33+
34+
- name: Retrieve docs
35+
run: bin/retrieve-documentation
36+
37+
- name: Build website
38+
env:
39+
GITHUB_KEY: ${{ secrets.CONTRIBUTORS_GITHUB_TOKEN }}
40+
NODE_OPTIONS: --openssl-legacy-provider
41+
run: yarn gatsby build
42+
43+
- name: Deploy
44+
uses: peaceiris/actions-gh-pages@v3
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
publish_dir: ./public
48+
cname: api-platform.com
49+
50+
- name: Auth gcloud
51+
uses: google-github-actions/auth@v1
52+
with:
53+
credentials_json: ${{ secrets.BUCKET_CREDS }}
54+
55+
- name: 'Set up Cloud SDK'
56+
uses: 'google-github-actions/setup-gcloud@v1'
57+
58+
- name: Deploy on bucket
59+
run: gsutil -m rsync -d -r ./public gs://api-platform-website-v3/

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515
with:
1616
fetch-depth: 0
1717

@@ -24,7 +24,7 @@ jobs:
2424
DEFAULT_BRANCH: main
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626

27-
- uses: actions/cache@v2
27+
- uses: actions/cache@v3
2828
with:
2929
path: ~/.cache/pip
3030
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

admin/customizing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ For instance, using an autocomplete input is straightforward, [checkout the dedi
182182
API Platform is built on top of [React Admin](https://marmelab.com/react-admin/).
183183
You can use all the features provided by the underlying library with API Platform Admin, including support for [authentication](https://marmelab.com/react-admin/Authentication.html), [authorization](https://marmelab.com/react-admin/Authorization.html) and deeper customization.
184184

185-
To learn more about these capabilities, refer to [the React Admin documentation](https://marmelab.com/react-admin/).
185+
To learn more about these capabilities, refer to [the React Admin documentation](https://marmelab.com/react-admin/documentation.html).

admin/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ library to expose a nice, responsive, management interface (Create-Retrieve-Upda
1717

1818
You can **customize everything** by using provided React Admin and [MUI](https://mui.com/) components, or by writing your custom [React](https://reactjs.org/) components.
1919

20+
<p align="center" class="symfonycasts"><a href="https://symfonycasts.com/screencast/api-platform/react-admin?cid=apip"><img src="../distribution/images/symfonycasts-player.png" alt="React Admin Screencast"><br>Watch the React Admin screencast</a></p>
21+
2022
## Features
2123

2224
* Automatically generates an admin interface for all the resources of the API thanks to the hypermedia features of Hydra or to the OpenAPI documentation

core/configuration.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ api_platform:
6464

6565
# Enable the docs.
6666
enable_docs: true
67-
67+
6868
# Enable the data collector and the WebProfilerBundle integration.
6969
enable_profiler: true
7070

@@ -157,7 +157,7 @@ api_platform:
157157
swagger:
158158
# The active versions of OpenAPI to be exported or used in the swagger_ui. The first value is the default.
159159
versions: [2, 3]
160-
160+
161161
# The swagger API keys.
162162
api_keys: []
163163
# The name of the header or query parameter containing the API key.
@@ -192,7 +192,7 @@ api_platform:
192192
url:
193193

194194
swagger_ui_extra_configuration:
195-
# Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing).
195+
# Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing).
196196
docExpansion: list
197197
# If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown.
198198
filter: false
@@ -322,7 +322,9 @@ api_platform:
322322
xkey:
323323
glue: ' '
324324

325-
normalization_context: ~
325+
normalization_context:
326+
# Default value to omit null values in conformance with the JSON Merge Patch RFC.
327+
skip_null_values: true
326328
denormalization_context: ~
327329
swagger_context: ~
328330
openapi_context: ~
@@ -373,5 +375,8 @@ api_platform:
373375
# The URL generation strategy to use for IRIs
374376
url_generation_strategy: !php/const ApiPlatform\Api\UrlGeneratorInterface::ABS_PATH
375377

378+
# To enable collecting denormalization errors
379+
collectDenormalizationErrors: false
380+
376381
# ...
377382
```

core/controllers.md

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@ use Symfony\Component\HttpKernel\Attribute\AsController;
4444
#[AsController]
4545
class CreateBookPublication extends AbstractController
4646
{
47-
private $bookPublishingHandler;
48-
49-
public function __construct(BookPublishingHandler $bookPublishingHandler)
50-
{
51-
$this->bookPublishingHandler = $bookPublishingHandler;
52-
}
47+
public function __construct(
48+
private BookPublishingHandler $bookPublishingHandler
49+
) {}
5350

5451
public function __invoke(Book $book): Book
5552
{
@@ -75,7 +72,6 @@ The entity is retrieved in the `__invoke` method thanks to a dedicated argument
7572

7673
When using `GET`, the `__invoke()` method parameter will receive the identifier and should be called the same as the resource identifier.
7774
So for the path `/user/{uuid}/bookmarks`, you must use `__invoke(string $uuid)`.
78-
**Warning: the `__invoke()` method parameter [MUST be called `$data`](https://symfony.com/doc/current/components/http_kernel.html#4-getting-the-controller-arguments)**, otherwise, it will not be filled correctly!
7975

8076
Services (`$bookPublishingHandler` here) are automatically injected thanks to the autowiring feature. You can type-hint any service
8177
you need and it will be autowired too.
@@ -117,14 +113,15 @@ class Book
117113

118114
```yaml
119115
# api/config/api_platform/resources.yaml
120-
App\Entity\Book:
121-
operations:
122-
ApiPlatform\Metadata\Get: ~
123-
post_publication:
124-
class: ApiPlatform\Metadata\Post
125-
method: POST
126-
uriTemplate: /books/{id}/publication
127-
controller: App\Controller\CreateBookPublication
116+
resources:
117+
App\Entity\Book:
118+
operations:
119+
ApiPlatform\Metadata\Get: ~
120+
post_publication:
121+
class: ApiPlatform\Metadata\Post
122+
method: POST
123+
uriTemplate: /books/{id}/publication
124+
controller: App\Controller\CreateBookPublication
128125
```
129126
130127
```xml
@@ -188,14 +185,15 @@ class Book
188185

189186
```yaml
190187
# api/config/api_platform/resources.yaml
191-
App\Entity\Book:
192-
operations:
193-
ApiPlatform\Metadata\Get: ~
194-
post_publication:
195-
class: ApiPlatform\Metadata\Post
196-
method: POST
197-
uriTemplate: /books/{id}/publication
198-
controller: ApiPlatform\Action\PlaceholderAction
188+
resources:
189+
App\Entity\Book:
190+
operations:
191+
ApiPlatform\Metadata\Get: ~
192+
post_publication:
193+
class: ApiPlatform\Metadata\Post
194+
method: POST
195+
uriTemplate: /books/{id}/publication
196+
controller: ApiPlatform\Action\PlaceholderAction
199197
```
200198
201199
```xml
@@ -258,15 +256,16 @@ class Book
258256

259257
```yaml
260258
# api/config/api_platform/resources.yaml
261-
App\Entity\Book:
262-
operations:
263-
ApiPlatform\Metadata\Get: ~
264-
post_publication:
265-
class: ApiPlatform\Metadata\Get
266-
uriTemplate: /books/{id}/publication
267-
controller: App\Controller\CreateBookPublication
268-
normalizationContext:
269-
groups: ['publication']
259+
resources:
260+
App\Entity\Book:
261+
operations:
262+
ApiPlatform\Metadata\Get: ~
263+
post_publication:
264+
class: ApiPlatform\Metadata\Get
265+
uriTemplate: /books/{id}/publication
266+
controller: App\Controller\CreateBookPublication
267+
normalizationContext:
268+
groups: ['publication']
270269
```
271270
272271
```xml
@@ -329,14 +328,15 @@ class Book
329328

330329
```yaml
331330
# api/config/api_platform/resources.yaml
332-
App\Entity\Book:
333-
operations:
334-
ApiPlatform\Metadata\Get: ~
335-
post_publication:
336-
class: ApiPlatform\Metadata\Post
337-
uriTemplate: /books/{id}/publication
338-
controller: App\Controller\CreateBookPublication
339-
read: false
331+
resources:
332+
App\Entity\Book:
333+
operations:
334+
ApiPlatform\Metadata\Get: ~
335+
post_publication:
336+
class: ApiPlatform\Metadata\Post
337+
uriTemplate: /books/{id}/publication
338+
controller: App\Controller\CreateBookPublication
339+
read: false
340340
```
341341
342342
```xml
@@ -401,14 +401,15 @@ class Book
401401

402402
```yaml
403403
# api/config/api_platform/resources.yaml
404-
App\Entity\Book:
405-
operations:
406-
ApiPlatform\Metadata\Get: ~
407-
post_publication:
408-
class: ApiPlatform\Metadata\Post
409-
routeName: book_post_publication
410-
book_post_discontinuation:
411-
class: ApiPlatform\Metadata\Post
404+
resources:
405+
App\Entity\Book:
406+
operations:
407+
ApiPlatform\Metadata\Get: ~
408+
post_publication:
409+
class: ApiPlatform\Metadata\Post
410+
routeName: book_post_publication
411+
book_post_discontinuation:
412+
class: ApiPlatform\Metadata\Post
412413
```
413414
414415
```xml

core/dto.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ class Book {}
140140
```
141141
```yaml
142142
# api/config/api_platform/resources.yaml
143-
App\Entity\Book:
144-
operations:
145-
ApiPlatform\Metadata\Post:
146-
output: App\Dto\AnotherRepresentation
147-
processor: App\State\BookRepresentationProcessor
143+
resources:
144+
App\Entity\Book:
145+
operations:
146+
ApiPlatform\Metadata\Post:
147+
output: App\Dto\AnotherRepresentation
148+
processor: App\State\BookRepresentationProcessor
148149
```
149150
```xml
150151
<?xml version="1.0" encoding="UTF-8" ?>

0 commit comments

Comments
 (0)