OpenAPI

API Platform Admin has a native support for API exposing an OpenAPI documentation.

API Platform Admin には、OpenAPI ドキュメントを公開する API のネイティブ サポートがあります。

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

これを使用するには、API のエントリポイントと JSON の OpenAPI ドキュメントのエントリポイントで、OpenApiAdmin コンポーネントを使用します。

import { OpenApiAdmin } from "@api-platform/admin";

export default () => (
  <OpenApiAdmin entrypoint="https://demo.api-platform.com" docEntrypoint="https://demo.api-platform.com/docs.json" />
);

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.

注: OpenAPI ドキュメントは、基礎となる api-doc-parser によって正しく理解されるために、いくつかの仮定に従う必要があります。api-doc-parser ライブラリ README の専用部分を参照してください。

Data Provider

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

デフォルトでは、コンポーネントは非常に基本的なデータ プロバイダーを使用し、ページネーションはサポートされていません。

If you want to use another data provider, pass the dataProvider prop to the component:

別のデータ プロバイダーを使用する場合は、 dataProvider プロパティをコンポーネントに渡します。

import { OpenApiAdmin } from "@api-platform/admin";
import drfProvider from "ra-data-django-rest-framework";

export default () => (
  <OpenApiAdmin
    dataProvider={drfProvider("https://django-api.com")}
    entrypoint="https://django-api.com"
    docEntrypoint="https://django-api.com/docs.json"
  />
);

Mercure Support

Mercure support can be enabled manually by giving the mercure prop to the OpenApiAdmin component.

OpenApiAdmin コンポーネントに mercure prop を与えることで、Mercure サポートを手動で有効にすることができます。

See also the dedicated section.

専用のセクションも参照してください。