# TODO upgrade to 2.8
# https://github.com/FriendsOfSymfony/FOSRestBundle/releases/tag/2.8.0
fos_rest:
#    disable_csrf_role: IS_AUTHENTICATED_ANONYMOUSLY
#    unauthorized_challenge:  null
    param_fetcher_listener:
        enabled:              true
#        force:                false
#        service:              null
    cache_dir:            '%kernel.cache_dir%/fos_rest'
#    allowed_methods_listener:
#        enabled:              false
#        service:              null
    # TODO activate with 2.8
    # routing_loader: false
    routing_loader:
        default_format: json
        include_format: true
    body_converter:
        enabled:              true
#        validate:             false
#        validation_errors_argument:  validationErrors
#    service:
#        router:               router
#        templating:           templating
#        serializer:           null
#        view_handler:         fos_rest.view_handler.default
#        inflector:            fos_rest.inflector.doctrine
#        validator:            validator
    serializer:
#        version:              null
#        groups:               []
        serialize_null:       true
    view:
        default_engine:       twig
#        force_redirects:
#            name:                 ~
#        mime_types:
#            enabled:              false
#            service:              null
#            formats:
#                name:                 ~
#        formats:
#            name:                 ~
#        templating_formats:
#            name:                 ~
        view_response_listener:
            enabled:              true
#            force:                true
#            service:              null
        failed_validation:    400
#        empty_content:        204
#        serialize_null:       false
#        jsonp_handler:
#            callback_param:       callback
#            mime_type:            application/javascript+jsonp
    exception:
        enabled:              true
        # TODO active with 2.8
        # serialize_exceptions: false
        # TODO deprecated with 2.8
        # https://github.com/FriendsOfSymfony/FOSRestBundle/issues/2200#issuecomment-629150462
        # https://github.com/FriendsOfSymfony/FOSRestBundle/issues/2224
        exception_controller: 'fos_rest.exception.controller:showAction'
        codes:
#            'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
#            'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
#            'Symfony\Component\HttpKernel\Exception\NotFoundHttpException': 400
        messages:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
            'Symfony\Component\HttpKernel\Exception\NotFoundHttpException': true
    body_listener:
        enabled:              true
#        service:              null
#        default_format:       null
#        throw_exception_on_unsupported_content_type:  false
#        decoders:
#            name:                 ~
        array_normalizer:
            service:              fos_rest.normalizer.camel_keys
            forms:                true
    format_listener:
        enabled: true
#        service:              null
        rules:
            - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, xml ] }
#            host:                 null     # URL host name
#            methods:              null     # Method for URL
#            stop:                 false
#            attributes:           []
#    versioning:
#        enabled: false
#        default_version: ~
#        resolvers:
#            query:
#                enabled: true
#                parameter_name: version
#            custom_header:
#                enabled: true
#                header_name: X-Accept-Version
#            media_type:
#                enabled: true
#                regex: /(v|version)=(?P<version>[0-9\.]+)/
#        guessing_order:
#            - query
#            - custom_header
#            - media_type
    zone:
        - { path: ^/api/* }
