FOSRestBundle response format from validator

I use FOSRestBundle and when, for example, the field is empty, instead of a nice `

{
"error:" "Enter your name"
}` 

message, it shows me such a strange message

{
    "error": "Object(AppEntityUser).name:n    Please enter name (code c1051bb4-d103-4f74-8988-acbcafc7fdc3)n"
}

my fos_rest.yaml

fos_rest:
    routing_loader:
        default_format: json
        include_format: false
    body_listener: true
    format_listener:
        rules:
            - { path: '^/', priorities: ['json'], fallback_format: json, prefer_extension: false }
    param_fetcher_listener: true
    access_denied_listener:
        json: true
    view:
        view_response_listener: 'force'
        formats:
            json: true
            xml: false
    exception:
        exception_controller: 'fos_rest.exception.controller:showAction'
        codes:
            DoctrineORMEntityNotFoundException: 404

How can i change this?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *