Skip to content

Commit

Permalink
Merge branch '4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Sep 25, 2024
2 parents 315e305 + 145d323 commit abe8dac
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
12 changes: 7 additions & 5 deletions admin/openapi.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# OpenAPI

API Platform Admin has a native support for API exposing an [OpenAPI documentation](https://www.openapis.org/).
API Platform Admin has native support for API exposing an [OpenAPI documentation](https://www.openapis.org/).

To use it, use the `OpenApiAdmin` component, with the entrypoint of the API and the entrypoint of the OpenAPI documentation in JSON:
To use it, use the `OpenApiAdmin` component, with the entry point of the API and the entry point of the OpenAPI documentation in JSON:

```javascript
import { OpenApiAdmin } from "@api-platform/admin";
Expand All @@ -12,12 +12,14 @@ export default () => (
);
```

**Note:** The OpenAPI documentation needs to follow some assumptions in order to be understood correctly by the underlying `api-doc-parser`.
See the [dedicated part in the `api-doc-parser` library README](https://github.com/api-platform/api-doc-parser#openapi-support).
> [!NOTE]
>
> The OpenAPI documentation needs to follow some assumptions to be understood correctly by the underlying `api-doc-parser`.
> See the [dedicated part in the `api-doc-parser` library README](https://github.com/api-platform/api-doc-parser#openapi-support).
## Data Provider

By default, the component will use a very basic data provider, without pagination support.
By default, the component will use a basic data provider, without pagination support.

If you want to use [another data provider](https://marmelab.com/react-admin/DataProviderList.html), pass the `dataProvider` prop to the component:

Expand Down
2 changes: 1 addition & 1 deletion core/dto.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

As stated in [the general design considerations](design.md), in most cases [the DTO pattern](https://en.wikipedia.org/wiki/Data_transfer_object) should be implemented using an API Resource class representing the public data model exposed through the API and [a custom State Provider](state-providers.md). In such cases, the class marked with `#[ApiResource]` will act as a DTO.

However, it's sometimes useful to use a specific class to represent the input or output data structure related to an operation. These techniques are very useful to document your API properly (using Hydra or OpenAPI) and will often be used on `POST` operations.
However, it's sometimes useful to use a specific class to represent the input or output data structure related to an operation. These techniques are useful to document your API properly (using Hydra or OpenAPI) and will often be used on `POST` operations.

## Implementing a Write Operation With an Input Different From the Resource

Expand Down
16 changes: 8 additions & 8 deletions core/migrate-from-fosrestbundle.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Migrate From FOSRestBundle

[FOSRestBundle](https://github.com/FriendsOfSymfony/FOSRestBundle) is a popular bundle to rapidly develop RESTful APIs with Symfony.
This page provides a guide to help developers migrating from FOSRestBundle to API Platform.
This page provides a guide to help developers migrate from FOSRestBundle to API Platform.

[On 21 September, 2021](https://twitter.com/lsmith/status/1440216817876627459), FOSRestBundle's creators recommended to use API Platform.
[On 21 September 2021](https://x.com/lsmith/status/1440216817876627459), FOSRestBundle's creators recommended to use API Platform.

## Features Comparison

Expand All @@ -13,13 +13,13 @@ The table below provides a list of the main features you can find in FOSRestBund

**In FOSRestBundle**

Create a controller extending the `AbstractFOSRestController` abstract class, make your magic manually in your methods and return responses through the `handleView()` provided by FOSRest's `ControllerTrait`.
Create a controller extending the `AbstractFOSRestController` abstract class, make your magic manually in your methods, and return responses through the `handleView()` provided by FOSRest's `ControllerTrait`.

See [The view layer](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/3.x/Resources/doc/2-the-view-layer.rst).

**In API Platform**

Add the `ApiResource` attribute to your entities, and enable operations you desire inside. By default, every operations are activated.
Add the `ApiResource` attribute to your entities, and enable the operations you desire inside. By default, every operation is activated.

See [Operations](operations.md).

Expand All @@ -33,7 +33,7 @@ Same as above.

Even though this is not recommended, API Platform allows you to [create custom controllers](controllers.md) and declare them in your entity's `ApiResource` attribute.

You can use them as you migrate from FOSRestBundle, but you should consider [switching to Symfony Messenger](messenger.md) as it will give you more benefits, such as compatibility with both REST and GraphQL, and better performances of your API on big tasks.
You can use them as you migrate from FOSRestBundle, but you should consider [switching to Symfony Messenger](messenger.md) as it will give you more benefits, such as compatibility with both REST and GraphQL and better performances of your API on big tasks.

See [General Design Considerations](design.md).

Expand All @@ -52,11 +52,11 @@ Use the `ApiResource` attribute to activate the HTTP methods you need for your e

See [Operations](operations.md).

### Hook into the requests handling
### Hook into the handling of the requests

**In FOSRestBundle**

Listen to FOSRest's events to modify the requests before they come into your controllers, and the responses after they come out of them.
Listen to FOSRest's events to modify the requests before they come into your controllers and the responses after they come out of them.

See [Listener support](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/3.x/Resources/doc/3-listener-support.rst).

Expand Down Expand Up @@ -140,6 +140,6 @@ See [API versioning](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/3.x/

**In API Platform**

API Platform has no native support to API versioning, but instead provides an approach consisting of deprecating resources when needed. It allows a smoother upgrade for clients, as they need to change their code only when it is necessary.
API Platform has no native support for API versioning, but instead provides an approach consisting of deprecating resources when needed. It allows a smoother upgrade for clients, as they need to change their code only when it is necessary.

See [Deprecating Resources and Properties](deprecations.md).
2 changes: 1 addition & 1 deletion core/subresources.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Subresource is another way of declaring a resource that usually involves a mor
In API Platform you can declare as many `ApiResource` as you want on a PHP class
creating Subresources.

Subresources work very well by implementing your own state [providers](./state-providers.md)
Subresources work well by implementing your own state [providers](./state-providers.md)
or [processors](./state-processors.md). In API Platform we provide a working Doctrine layer for
subresources providing you add the correct configuration for URI Variables.

Expand Down
10 changes: 5 additions & 5 deletions extra/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ A new minor version is released every six months, and a new major version is rel

For example:

- version 3.0 has been released on 15 September, 2022;
- version 3.1 has been released on 23 January, 2023;
- version 3.2 has been released on 12 October, 2023;
- version 3.3 has been released on 9 April, 2024 (we were a little late, it should have been published in March);
- versions 3.4 and 4.0 will be released on September, 2024.
- version 3.0 has been released on 15 September 2022;
- version 3.1 has been released on 23 January 2023;
- version 3.2 has been released on 12 October 2023;
- version 3.3 has been released on 9 April 2024 (we were a little late, it should have been published in March);
- versions 3.4 and 4.0 will be released on September 2024.

## Maintenance

Expand Down
4 changes: 2 additions & 2 deletions laravel/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ With API Platform, you can:

* [expose your Eloquent](#exposing-a-model) models in minutes as:
* a REST API implementing the industry-leading standards, formats and best practices: [JSON-LD](https://en.wikipedia.org/wiki/JSON-LD)/[RDF](https://en.wikipedia.org/wiki/Resource_Description_Framework), [JSON:API](https://jsonapi.org), [HAL](https://stateless.group/hal_specification.html), and many RFCs...
* a [GraphQL](https://graphql.org/) API
* a [GraphQL](#enabling-graphql) API
* or both at the same time, with the same code!
* automatically expose an [OpenAPI](https://www.openapis.org) specification (formerly Swagger), dynamically generated from your Eloquent models and always up to date
* automatically expose nice UIs and playgrounds to develop using your API ([Swagger UI](https://swagger.io/tools/swagger-ui/) and [GraphiQL](https://github.com/graphql/graphiql))
Expand Down Expand Up @@ -589,7 +589,7 @@ php artisan make:request BookFormRequest

Then, add validation rules to the generated class (`app/Http/Requests/BookFormRequest.php` in our example):

```php
```patch
namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
Expand Down

0 comments on commit abe8dac

Please sign in to comment.