Standard JSON formatter for your entity.
Standard JSON formatter for your entity. It ensures the Id field of your Model object is always present. You would typically wrap this around a
Json.format[Entity]
.
Known issue with this formatting. When an id field is sent with other invalid/missing fields, produces a weird responses like so:
-
{"obj.id.username":[{"msg":"error.path.missing","args":[]}],"obj.id.firstName":[{"msg":"error.path.missing","args":[]}]}
-
JsError(List((/id/username,List(ValidationError(error.path.missing,WrappedArray()))), (/id/firstName,List(ValidationError(error.path.missing,WrappedArray())))))
Json.format[Entity] }}}
Known issue with this formatting. When an id field is sent with other invalid/missing fields, produces a weird responses like so:
-
{"obj.id.username":[{"msg":"error.path.missing","args":[]}],"obj.id.firstName":[{"msg":"error.path.missing","args":[]}]}
-
JsError(List((/id/username,List(ValidationError(error.path.missing,WrappedArray()))), (/id/firstName,List(ValidationError(error.path.missing,WrappedArray())))))
Use this Formatter for Mongo Repositories.
Use this Formatter for Mongo Repositories. It ensures the Id field of your Model object is always present, and formatted correctly for ReactiveMongo database operations. Typically, you do not wish to use this for in/out messaging via RestControllers etc.
Base formatter to wrap (typically, this is a Json.format[Entity]
Model Extensions for Handling JSON and Mongo formats.