Intro to graphql python/strawberry

course is great so far!
having an issue with openapi-python-client generating the spotify-client
when I run “openapi-python-client generate --meta none --path data/openapi.json”
I can’t get past this error:

Error(s) encountered while generating, client was not created

ruff failed

models\spotify_object_authorization_code_credentials.py:62:22: F821 Undefined name cast
models\spotify_request_query_params_get_mefollowing.py:48:16: F821 Undefined name cast
models\spotify_request_query_params_get_search.py:69:28: F821 Undefined name cast
Found 1929 errors (1926 fixed, 3 remaining).

Screenshot 2024-07-06 061915

unsure on both ruff and what/where ‘cast’ should be?

1 Like

Yep, me too. It’s a great course but now I’m stuck with “Undefined name cast”.

Without rm -rf mock_spotify_rest_api_client, ‘cast’ does not exist in the source tree.
% rm -rf mock_spotify_rest_api_client && grep -r cast .
# nothing found

Environment:
Ubuntu 22.04.4 LTS within WSL2 / Windows 11
Python 3.12.4
openapi-python-client version: 0.21.1
ruff-0.4.10

Apollo GraphQL deacons, please advise us lowly acolytes.

If you need further info, please inquire.

Thanks and have a wonderful day!

I dug into this a bit further. While ruff did have a similar issue once, in this case the generated python files are missing: “from typing import cast”

SOLVED: Simply revert back to 0.18.0 version of openapi-python-client. It works fine then. Have a wonderful day!