Support nested arrays of primitive values inside of objects #120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
It's a useful pattern to define a single JSON schema for all your (e.g. query) parameters, and handle them as a single object in your code.
In OpenAPI, that'd be expressed like this, for example:
Until now, the
myList
property would not be allowed, and would fail to serialize and parse, as arrays within objects were not allowed forform
style parameters (used by query items, by default).Modifications
This PR extends the support of the
form
style to handle single nesting in the top level objects. It does not add support for arbitrarily deep nesting.As part of this work, we also now allow the
deepObject
style to do the same - use arrays nested in an object.Result
The useful pattern of having an array within a "params" object works correctly now.
Test Plan
Added unit tests for all 4 components: encoder, decoder, serializer, and parser.