[dart2] [client] Adds correct deserialization of octet-streams into Uint8List#17810
Open
0xNF wants to merge 1 commit intoOpenAPITools:masterfrom
Open
[dart2] [client] Adds correct deserialization of octet-streams into Uint8List#178100xNF wants to merge 1 commit intoOpenAPITools:masterfrom
0xNF wants to merge 1 commit intoOpenAPITools:masterfrom
Conversation
… Uint8Lists (OpenAPITools#12161) * Imported typed_data * File and Binary response return types are now marked as Uint8List instead of MultipartFile, which was never semantically correct * _decodeBodyBytes has been reworked to return either 'String' or 'Uint8List' based on the ContentType. * _deserialize now returns 'dynamic' to work with the new _decodeBodyBytes
5 tasks
kuhnroyal
suggested changes
Feb 15, 2024
Contributor
kuhnroyal
left a comment
There was a problem hiding this comment.
I don't have a test project for this. Can anyone verify up/downloads?
| } | ||
|
|
||
| private void configureSerializationLibrary(String srcFolder) { | ||
| additionalProperties.put("useJsonSerializable", "true"); |
Contributor
There was a problem hiding this comment.
Is this used? I thought there is only native serialization.
|
Progress status? |
if you want to fix this issue, than you can use your own template
templateDir: /template
typeMappings:
"string+binary": "Uint8List"
then run openapi-generator-cli generate \
-g dart-dio \
-i oas.yaml \
-o /package \
-c config.yaml |
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.
fix #12161
This PR is part of the effort to split PR #17548
This PR is a bit meatier than the others -- I copied much of the logic for adding uint8list support to the AbstractDartCodegen from the Dart-dio generator.
The big changes to look out for are:
decodeBodyBytes()anddeserialize()now returnsdynamicinstead of String, which lets us switch on thecontent-typeto return either a string, or a Uint8List.@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)