Skip to content

Conversation

p1-ra
Copy link
Contributor

@p1-ra p1-ra commented May 17, 2021

This PR aims to fix form data serialization.

Form data model was serialized using attr.asdict, which is not aware of the internal type UNSET and was serializing UNSET references.

This PR replace the call to attr.asdict with <Model>.to_dict method, which knows how to properly serialize UNSET values.

Before:
image

After:
image

p1-ra added 2 commits May 17, 2021 17:04
…e <Model>.to_dict()` serializer

   - to handle internal UNSET values to not serialize them,
     `attr.asdict` do not know UNSET type and will serialize them
@codecov
Copy link

codecov bot commented May 17, 2021

Codecov Report

Merging #430 (1b17d1f) into main (0f58cfd) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #430   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           47        47           
  Lines         1548      1548           
=========================================
  Hits          1548      1548           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f58cfd...1b17d1f. Read the comment docs.

@dbanty
Copy link
Collaborator

dbanty commented May 17, 2021

Relates to #372 which I keep neglecting to finish up 😅

@dbanty
Copy link
Collaborator

dbanty commented May 17, 2021

@p1-ra if you're more familiar with form stuff, could you take a look at that other PR and the questions I had about it? Specifically about using JSON in the form.

@p1-ra p1-ra mentioned this pull request May 17, 2021
@dbanty dbanty added this to the 0.9.2 milestone May 24, 2021
@dbanty dbanty changed the base branch from main to support/0.9.x May 24, 2021 23:10
@dbanty dbanty merged commit 2421642 into openapi-generators:support/0.9.x May 24, 2021
dbanty pushed a commit that referenced this pull request May 24, 2021
…. Thanks @p1-ra!

* templates / endpoint_module / form_data: do not use `attr.asdict`, use <Model>.to_dict()` serializer

   - to handle internal UNSET values to not serialize them,
     `attr.asdict` do not know UNSET type and will serialize them

* e2e / update golden-record
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants