Skip to content

Commit ad1458c

Browse files
committed
Merge branch '2.3'
2 parents ac59baf + a176583 commit ad1458c

File tree

11 files changed

+88
-16
lines changed

11 files changed

+88
-16
lines changed

admin/getting-started.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ in the `admin/src/Component/User` directory:
321321
// admin/src/Component/User/Create.js
322322

323323
import React from 'react';
324-
import { Create, SimpleForm, TextInput, email, required } from 'react-admin';
324+
import { Create, SimpleForm, TextInput, email, required, ArrayInput, SimpleFormIterator } from 'react-admin';
325325

326326
export const UserCreate = (props) => (
327327
<Create { ...props }>
@@ -330,6 +330,11 @@ export const UserCreate = (props) => (
330330
<TextInput source="plainPassword" label="Password" validate={ required() } />
331331
<TextInput source="name" label="Name"/>
332332
<TextInput source="phone" label="Phone"/>
333+
<ArrayInput source="roles" label="Roles">
334+
<SimpleFormIterator>
335+
<TextInput />
336+
</SimpleFormIterator>
337+
</ArrayInput>
333338
</SimpleForm>
334339
</Create>
335340
);
@@ -340,7 +345,7 @@ export const UserCreate = (props) => (
340345
// admin/src/Component/User/Edit.js
341346

342347
import React from 'react';
343-
import { Edit, SimpleForm, DisabledInput, TextInput, DateInput, email } from 'react-admin';
348+
import { Edit, SimpleForm, DisabledInput, TextInput, email, ArrayInput, SimpleFormIterator, DateInput } from 'react-admin';
344349

345350
export const UserEdit = (props) => (
346351
<Edit {...props}>
@@ -349,6 +354,11 @@ export const UserEdit = (props) => (
349354
<TextInput source="email" label="Email" validate={ email() } />
350355
<TextInput source="name" label="Name"/>
351356
<TextInput source="phone" label="Phone"/>
357+
<ArrayInput source="roles" label="Roles">
358+
<SimpleFormIterator>
359+
<TextInput />
360+
</SimpleFormIterator>
361+
</ArrayInput>
352362
<DateInput disabled source="createdAt" label="Date"/>
353363
</SimpleForm>
354364
</Edit>

admin/images/admin-demo.gif

1.52 MB
Loading

admin/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# The API Platform Admin
22

3+
![Screencast](images/admin-demo.gif)
4+
35
API Platform Admin is a tool to automatically create a fancy (Material Design) and fully featured administration interface
46
for any API supporting [the Hydra Core Vocabulary](http://www.hydra-cg.com/), including but not limited to all APIs created
57
using [the API Platform framework](https://api-platform.com).

core/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ api_platform:
173173
Symfony\Component\Serializer\Exception\ExceptionInterface: 400
174174

175175
# Or with a constant defined in the 'Symfony\Component\HttpFoundation\Response' class.
176-
ApiPlatform\Core\Exception\InvalidArgumentException: !php/const:Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
176+
ApiPlatform\Core\Exception\InvalidArgumentException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
177177

178178
# ...
179179

core/deprecations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ You can also use this new `deprecationReason` attribute to deprecate specific [o
5454

5555
```php
5656
<?php
57-
// api/src/Entity/Review.php
57+
// api/src/Entity/Parchment.php
5858

5959
/**
6060
* @ApiResource(itemOperations={

core/graphql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Once enabled, you have nothing to do: your schema describing your API is automat
1212

1313
## Enabling GraphQL
1414

15-
To enable GraphQL and GraphiQL interface in your API, simply require the graphql-php package using Composer:
15+
To enable GraphQL and GraphiQL interface in your API, simply require the [graphql-php](https://webonyx.github.io/graphql-php/) package using Composer and clear the cache one more time:
1616

17-
$ composer require webonyx/graphql-php
17+
$ composer require webonyx/graphql-php && bin/console cache:clear
1818

1919
You can now use GraphQL at the endpoint: `http://localhost/graphql`.
2020

core/operations.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ class Answer
304304

305305
namespace App\Entity;
306306

307-
use ApiPlatform\Core\Annotation\ApiProperty;
308307
use ApiPlatform\Core\Annotation\ApiResource;
309308
use ApiPlatform\Core\Annotation\ApiSubresource;
310309
use Doctrine\ORM\Mapping as ORM;
@@ -422,7 +421,7 @@ Or in XML:
422421
<attribute name="method">GET</attribute>
423422
<attribute name="normalization_context">
424423
<attribute name="groups">
425-
<group>foobar</group>
424+
<attribute>foobar</attribute>
426425
</attribute>
427426
</attribute>
428427
</collectionOperation>
@@ -479,6 +478,7 @@ The `subresourceOperations` attribute also allows you to add an access control o
479478
* }
480479
* }
481480
* )
481+
*/
482482
class Answer
483483
{
484484
}
@@ -517,7 +517,7 @@ class Question
517517

518518
API Platform can leverage the Symfony routing system to register custom operations related to custom controllers. Such custom
519519
controllers can be any valid [Symfony controller](http://symfony.com/doc/current/book/controller.html), including standard
520-
Symfony controllers extending the [`Symfony\Bundle\FrameworkBundle\Controller\Controller`](http://api.symfony.com/3.1/Symfony/Bundle/FrameworkBundle/Controller/Controller.html)
520+
Symfony controllers extending the [`Symfony\Bundle\FrameworkBundle\Controller\AbstractController`](http://api.symfony.com/4.1/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.html)
521521
helper class.
522522

523523
However, API Platform recommends to use **action classes** instead of typical Symfony controllers. Internally, API Platform
@@ -727,7 +727,7 @@ Or in XML:
727727
<attribute name="controller">App\Controller\BookSpecial</attribute>
728728
<attribute name="normalization_context">
729729
<attribute name="groups">
730-
<group>special</group>
730+
<attribute>special</attribute>
731731
</attribute>
732732
</attribute>
733733
</itemOperation>
@@ -921,11 +921,11 @@ exactly the same thing than the previous example in a more Symfony-like fashion:
921921
namespace App\Controller;
922922
923923
use App\Entity\Book;
924-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
924+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
925925
926-
class BookController extends Controller
926+
class BookController extends AbstractController
927927
{
928-
public function specialAction(Book $data, MyService $service): Book
928+
public function special(Book $data, MyService $service): Book
929929
{
930930
return $service->doSomething($data);
931931
}

core/serialization.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ framework:
5454
If you use [Symfony Flex](https://github.com/symfony/flex), just execute `composer req doctrine/annotations` and you are
5555
all set!
5656

57+
If you want to use YAML or XML, please add the mapping path in the serializer configuration:
58+
59+
```yaml
60+
# api/config/packages/api_platform.yaml
61+
framework:
62+
serializer:
63+
mapping:
64+
paths: ['%kernel.project_dir%/config/serialization']
65+
```
66+
5767
## Using Serialization Groups
5868

5969
It is simple to specify what groups to use in the API system:

core/swagger.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ class User
234234

235235
You also have full control over both built-in and custom operations documentation:
236236

237+
In Yaml:
238+
237239
```yaml
238240
resources:
239241
App\Entity\Rabbit:
@@ -262,6 +264,54 @@ resources:
262264
description: Pink rabbit
263265
```
264266
267+
or with XML:
268+
269+
```xml
270+
<?xml version="1.0" encoding="UTF-8" ?>
271+
<resources xmlns="https://api-platform.com/schema/metadata"
272+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
273+
xsi:schemaLocation="https://api-platform.com/schema/metadata
274+
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
275+
<resource class="App\Entity\Rabbit">
276+
<collectionOperations>
277+
<collectionOperation name="create_user">
278+
<attribute name="method">get</attribute>
279+
<attribute name="path">/rabbit/rand</attribute>
280+
<attribute name="controller">App\Controller\RandomRabbit</attribute>
281+
<attribute name="swagger_context">
282+
<attribute name="summary">Random rabbit picture</attribute>
283+
<attribute name="description">
284+
# Pop a great rabbit picture by color!
285+
286+
![A great rabbit](https://rabbit.org/graphics/fun/netbunnies/jellybean1-brennan1.jpg)
287+
</attribute>
288+
<attribute name="parameters">
289+
<attribute>
290+
<attribute name="in">body</attribute>
291+
<attribute name="schema">
292+
<attribute name="type">object</attribute>
293+
<attribute name="properties">
294+
<attribute name="name">
295+
<attribute name="type">string</attribute>
296+
</attribute>
297+
<attribute name="description">
298+
<attribute name="type">string</attribute>
299+
</attribute>
300+
</attribute>
301+
</attribute>
302+
<attribute name="example">
303+
<attribute name="name">Rabbit</attribute>
304+
<attribute name="description">Pink rabbit</attribute>
305+
</attribute>
306+
</attribute>
307+
</attribute>
308+
</attribute>
309+
</collectionOperation>
310+
</collectionOperations>
311+
</resource>
312+
</resources>
313+
```
314+
265315
![Impact on swagger ui](../distribution/images/swagger-ui-2.png)
266316

267317
## Changing the Swagger UI Location

extra/releases.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ API Platform follows the [Semantic Versioning](https://semver.org) strategy.
44

55
Only 3 versions are maintained at the same time:
66

7-
* **stable** (currently the **2.2** branch): regular bug fixes are integrated in this version
8-
* **old-stable** (currently **2.1** branch): security fixes are integrated in this version, regular bug fixes are **not** backported in it
7+
* **stable** (currently the **2.3** branch): regular bug fixes are integrated in this version
8+
* **old-stable** (currently **2.2** branch): security fixes are integrated in this version, regular bug fixes are **not** backported in it
99
* **development** (**master** branch): new features target this branch
1010

1111
Older versions (1.x, 2.0...) **are not maintained**. If you still use them, you must upgrade as soon as possible.

schema-generator/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Example:
434434

435435
```yaml
436436
rdfa:
437-
- https://raw.githubusercontent.com/rvguha/schemaorg/master/data/schema.rdfa # Experimental version of Schema.org
437+
- https://raw.githubusercontent.com/schemaorg/schemaorg/master/data/schema.rdfa # Experimental version of Schema.org
438438
- http://example.com/data/myschema.rfa # Additional types
439439
```
440440

0 commit comments

Comments
 (0)