Skip to content

Conversation

da1910
Copy link
Collaborator

@da1910 da1910 commented Apr 4, 2022

Closes #170

This PR treats response data as a string if it's specified as str, even if it looks like json.

Sometimes APIs will return stringified json, currently this will throw when we attempt to deserialize it, since we will end up expecting a string but we will receive a dictionary. This PR makes response_type override the existing logic, so that this use case is supported.

@da1910 da1910 requested a review from Andy-Grigg April 4, 2022 15:12
@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

Merging #180 (431f2f6) into main (5bdaf8f) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
- Coverage   91.88%   91.87%   -0.01%     
==========================================
  Files           8        8              
  Lines         826      825       -1     
==========================================
- Hits          759      758       -1     
  Misses         67       67              
Impacted Files Coverage Δ
src/ansys/openapi/common/_api_client.py 97.92% <100.00%> (-0.01%) ⬇️

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 5bdaf8f...431f2f6. Read the comment docs.

Copy link
Contributor

@Andy-Grigg Andy-Grigg left a comment

Choose a reason for hiding this comment

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

These changes look good, and the new functionality is covered by a unit test. Not sure why coverage is showing a warning here.

@da1910 da1910 merged commit 42deac6 into main Apr 4, 2022
@da1910 da1910 deleted the fix/170-respect-str-response-type branch April 4, 2022 16:10
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.

Error when deserializing stringified JSON

2 participants