Repository navigation
fix(typescript-fetch): map-of-arrays responses and multipart arrays of models - #10
Merged
Merged
Conversation
A response typed { [key: string]: Array<X>; } rendered
runtime.mapValues(jsonValue, Array<X>FromJSON) and imported a
non-existent ArrayX, because the map's base type is the value type
"Array<X>". The parser now fills returnProperty (the Java field) so the
template maps each value with (items) => items.map(XFromJSON), imports X,
and passes maps of primitive or nested-container arrays through unmapped.
ReturnBaseType is unchanged: dart-fetch's map cast relies on it.
An array-of-model form field was csv-joined into "[object Object],…". It now goes as one application/json Blob of value.map(XToJSON), like a single model part already does (plain value under withoutRuntimeChecks, Array.from for uniqueItems). Arrays of files keep one append per file; arrays of primitives and of $ref to an enum or primitive schema stay csv.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two typescript-fetch fixes, one commit each.
Map of arrays response (
{ [key: string]: Array<X>; }). It renderedmapValues(jsonValue, Array<X>FromJSON)and imported a non-existentArrayX.Array<X>.returnProperty, so the template emits(items) => items.map(XFromJSON)and importsX.Multipart array of models. It was csv-joined into
"[object Object],…".value.map(XToJSON), like a single model part.$refs and primitive aliases.Tests
make testpasses andmake lintreports 0 issues.getStreetsandstorePhotos. Strict tsc passes, and the consumer's 763 tests pass.Not fixed here (also broken on master): multipart without a file field uses
URLSearchParams, so a JSON part arrives as"[object Blob]".