v3.0 OpenAPI

OpenAPI

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

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

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.

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:

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.

See also the dedicated section.

You can also help us improve the documentation of this page.

Made with love by

Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.

Learn more

Copyright © 2023 Kévin Dunglas

Sponsored by Les-Tilleuls.coop