0

私はJMSSerializerBundleをAPIのjsonのデシリアライザーに使用しているので、値が正しいかどうかを確認したいので、Symfonyアノテーションの検証を使用していますが、整数値の場合、jsonには文字列値JMSSerializerBundleがどのようにデフォルト値を0に設定します.

が整数でない場合に、このフィールドまたは別の整数フィールドに関するエラーを返す方法です。

Exemple:

{
"id":1, //integer
"name":"sad", //string
"simulation_id":"blablaba" //integer
}
JMSSerializerBundle Deserialize to

{
"id":1,
"name":"sad",
"simulation_id":0
}

次のようなエラーが発生したい

{

    "property_path": "simulationId",
    "message": "The value 'sad' is not a valid."
}
4

1 に答える 1