Skip to content

content returned as bytes instead of native python objects? #712

Answered by dbanty
pll asked this question in Q&A
Discussion options

You must be logged in to vote

If the return type is properly documented in the OpenAPI spec for the API, then there should be a Response.parsed field with the data deserialized already. You can also access this faster by calling the sync() method in the API module instead of sync_detailed() (if you don't need anything else on the Response object).

If the response type is not documented in the OpenAPI spec, then openapi-python-client has no way of knowing how to deserialize it, so you'll have to do it yourself. Your best bet might be to add a preprocessor to modify the openapi.yml before running the generator to insert the appropriate OpenAPI types.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pll
Comment options

Answer selected by pll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants