Skip to content

[dart][dart-dio] Remove manual json encode/decode calls in API classes#8812

Merged
wing328 merged 3 commits intoOpenAPITools:masterfrom
kuhnroyal:dart-dio/unnecessary-json-encode
Feb 24, 2021
Merged

[dart][dart-dio] Remove manual json encode/decode calls in API classes#8812
wing328 merged 3 commits intoOpenAPITools:masterfrom
kuhnroyal:dart-dio/unnecessary-json-encode

Conversation

@kuhnroyal
Copy link
Copy Markdown
Contributor

Dio automatically adds a default transformer which does call json.encode and json.decode when the content-type is application/json. When the content-type is different, then it is up to the consumer to configure the Dio instance correctly to support custom content-types.

Also tests!!!

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

CC @swipesight (2018/09) @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12)

Dio automatically adds a default transformer which does call `json.encode` and `json.decode` when the content-type is `application/json`. When the content-type is different, then it  is up to the consumer to configure the Dio instance correctly to support custom content-types.

Also tests!!!
@kuhnroyal
Copy link
Copy Markdown
Contributor Author

Had to constraint the test dependency everywhere. Starting at 1.16.0 it requires Dart 2.12.0 - not sure why they didn't increase the major version.

@agilob
Copy link
Copy Markdown
Contributor

agilob commented Feb 23, 2021

ah yay, dependency hell in code generator 😭

@wing328 wing328 added this to the 5.1.0 milestone Feb 24, 2021
@wing328 wing328 merged commit 4f4f1d4 into OpenAPITools:master Feb 24, 2021
@kuhnroyal kuhnroyal deleted the dart-dio/unnecessary-json-encode branch February 24, 2021 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants