Add checks that Schema returns data convertible to JSON
neomerx opened this issue · comments
neomerx commented
Currently, a Schema might return data that are not convertible to JSON (e.g. file, stream, object, and etc). The issue becomes obvious only at the very last step when the whole document is converted to JSON string. At this point, it's very hard to tell what exactly causes the problem in json_encode()
function.
It's needed to add some debug checks for data from Schemas. Thus if a Schema for type posts
returns non-convertible data for attributes the package should notify immediately developer about the issue with assert()
function. Such checks should work only in debug mode and have no impact on performance in production mode.