Description
For an update request, the validators uses the schema to get the
5429
existing attributes of a resource. When doing this, it will call the schema's getAttributes()
method directly.
This means the values are not serialized, which means the value of an attribute may not match the expected values from a client.
Take dates for example. The validation rules will be expecting the client to provide date strings, as there is no date object in JSON. The schema could correctly be returning Carbon date objects in its getAttributes
method, as these would be converted to strings when passed into json_encode
. However, this means when the validator is working out the existing attributes, the values are date objects, not strings. This causes the ISO8601 rule from this package to fail.
This isn't the fault of the rule - it is right to expect date strings.
We should probably json_encode
then json_decode
the current attributes when getting them from the schema.