NelmioApiDocBundle Integration

NelmioApiDoc provides an alternative to the native Swagger/Open API support provided by API Platform.

NelmioApiDoc は、API プラットフォームによって提供されるネイティブの Swagger/Open API サポートに代わるものを提供します。

As NelmioApiDocBundle 3+ has built-in support for API Platform, this documentation is only relevant for people using NelmioApiDocBundle between version 2.9 and 3.0.

NelmioApiDocBundle 3+ には API プラットフォームのサポートが組み込まれているため、このドキュメントは、バージョン 2.9 から 3.0 の間で NelmioApiDocBundle を使用しているユーザーにのみ関連します。

For new projects, prefer using the built-in Swagger support and/or NelmioApiDoc 3.

新しいプロジェクトの場合は、組み込みの Swagger サポートや NelmioApiDoc 3 を使用することをお勧めします。

Screenshot of API Platform integrated with NelmioApiDocBundle

NelmioApiDocBundle is supported by API Platform since version 2.9.

NelmioApiDocBundle は、バージョン 2.9 以降の API プラットフォームでサポートされています。

To enable the NelmioApiDoc integration, copy the following configuration:

NelmioApiDoc 統合を有効にするには、次の構成をコピーします。

# api/config/packages/api_platform.yaml
api_platform:
    # ...

    enable_nelmio_api_doc: true

nelmio_api_doc:
    sandbox:
        accept_type: 'application/json'
        body_format:
            formats: ['json']
            default_format: 'json'
        request_format:
            formats:
                json: 'application/json'

Please note that NelmioApiDocBundle has a sandbox limitation where you cannot pass a JSON array as parameter, so you cannot use it to deserialize nested objects.

NelmioApiDocBundle には、JSON 配列をパラメーターとして渡すことができないというサンドボックスの制限があるため、ネストされたオブジェクトを逆シリアル化するために使用できないことに注意してください。