Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dart-dio] Serializes request bodies using a specific serializer #6384

Merged
merged 2 commits into from
Jan 5, 2021

Conversation

josh-burton
Copy link
Contributor

@josh-burton josh-burton commented May 21, 2020

Serializes request bodies using a specific serializer so a discriminator is not added

When using the generic serialize method, built value will add a descriminator to the serialized json. For APIs with strict parsing, this causes parsing errors.

By finding the specific serializer for the type built value omits the descriminator.

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

CC: @ircecho @swipesight @jaumard @amondnet

@kuhnroyal
Copy link
Contributor

@josh-burton What is missing to get this merged?

@josh-burton
Copy link
Contributor Author

I think CI is failing because of outdated samples, but I'm not sure how to generate new samples as the process seems to have changed.

@@ -126,7 +128,9 @@ class FakeApi {
List<String> contentTypes = ["application/json"];


var serializedBody = _serializers.serialize(body);

var bodySerializer = _serializers.serializerForType(bool);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work or does this need extra handling for primitives?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at the StandardJsonPlugin, I think this needs special handling for primitives. Probably a plain jsonEncode without any serializer?

@kuhnroyal
Copy link
Contributor

Something went wrong with the merge :o

@kuhnroyal
Copy link
Contributor

@josh-burton Can you update again so we can merge this before monday?

@wing328
Copy link
Member

wing328 commented Jan 5, 2021

Travis CI failure not related to this change.

@wing328 wing328 added this to the 5.0.1 milestone Jan 5, 2021
@wing328 wing328 merged commit 604ac6d into OpenAPITools:master Jan 5, 2021
kuhnroyal added a commit to kuhnroyal/openapi-generator that referenced this pull request Jan 5, 2021
This happened due to the merge of OpenAPITools#6384 where implicit-dynamics were still allowed.
wing328 pushed a commit that referenced this pull request Jan 5, 2021
This happened due to the merge of #6384 where implicit-dynamics were still allowed.
@wing328 wing328 changed the title [dart-dio] Serializes request bodies using a specific serializer so a… [dart-dio] Serializes request bodies using a specific serializer Feb 3, 2021
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.

None yet

3 participants