fix!: use arrays for collections instead of sets #70
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.
Because we have
uniqueItems: true
in our service definition yaml, fields withtype: array
are generated asSet
s by the typescript generator.Serialization/deserialization of these types is broken so where we use these APIs we pass arrays with
@ts-expect-error
anyway.It also makes pagination harder to use, since we need to set the
.after
field to get the next page of pins - sets have no guarantee of order so you have to first convert the current set of results into an array and sort it by creation date which is inefficient.It doesn't look possible to override the use of Set by the generator in a way that works (
type-mappings=set=array
produces uncompilable code) so manually change the generated code in the same way we have to change the import settings (due, I think, to another option that doesn't work).Also adds a note to the readme reminding people to do it.
BREAKING CHANGE: fields that were
Set
s such asPinResults.results
andPinsGetRequest.cid
are nowArray
s