Skip to content

Conversation

TimothyBJacobs
Copy link
Member

WIP

@TimothyBJacobs TimothyBJacobs mentioned this pull request Nov 28, 2019
6 tasks
@TimothyBJacobs TimothyBJacobs marked this pull request as ready for review December 9, 2019 16:31
@TimothyBJacobs TimothyBJacobs merged commit 4584b7a into master Dec 11, 2019
Copy link

@zanona zanona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @TimothyBJacobs , the only thing here is that the initial value for object meta type is still returned as an empty array rather than a JSON object.
As the initial value for number or integer types is 0, for a string, '', for both array and object types the REST API returns [] as opposed to [] and {} respectively.

@TimothyBJacobs
Copy link
Member Author

👋 @zanona. Yeah this is tricky and is a problem across all of the REST API. We use associative arrays for objects, which as you pointed out get json encoded as []. We can't simply use JSON_FORCE_OBJECT because sometimes we have actual empty arrays.

I think we would need a post processing layer of some kind that checks against the schema and switches out empty arrays to an stdClass instance if that property is defined in the schema as an object.

If you have a chance, it'd be great to open a trac ticket for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants