JSON response returned as string instead of dict (Flask integration)
JSON response returned as string instead of dict (Flask integration)
Description
SDK returns raw string instead of parsed JSON, adding boilerplate in Flask apps.
Code snippet
from flask import Flask
import json
app = Flask(__name__)
resp = client.request("GET", base_url, "/advance")
data = json.loads(resp)
Issue
Expected automatic JSON decoding.
Hey @francescobianco
Check this PR #12
I think the issue might be due to the fact that the client.request method is returning a raw string instead of a JSON object. Could you try checking the client.request method in openapi_python_sdk.client to see if it's explicitly returning a string or if there's an option to enable automatic JSON decoding?
Good point, thanks @IlyasFardaouix for digging into this.
We’re currently working on improving the test suite around this area, so things are still being refined. For now, we’re happy to accept any useful contributions that help move this forward.
Feel free to share ideas or open follow-up PRs if you find something that works well.