Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funcs.md: Fix mistakes and add example. #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emosenkis
Copy link
Contributor

No description provided.

@jhnnsrs
Copy link
Owner

jhnnsrs commented Nov 13, 2024

Thanks so much for your efforts! Really much appreciated :) especially the documentation needs so much more love. Do you have any suggestions?

@emosenkis
Copy link
Contributor Author

Thank you for making this tool! I don't remember any other documentation issues but I did run into some issues with the generated code that I worked around by modifying it after generation completed:

  • it crashes when graphqlrc is missing extensions.turms for any project, not just the one I asked it to generate
  • it can't continue if any fragment is unused
  • default values for global kwargs keep the type they have in the YAML file, making it impossible to use a non-trivial default value (e.g. setting default: utils.Unset results in python some_arg: SomeType = "utils.Unset", resulting in a string instead of the value of the UNSET constant)
  • imports needed to provide the default value of a kwarg aren't added automatically
  • imports for complex types don't work (e.g. using type: dict[str, Any] results in invalid imports)
  • having a scalar definition with python type None results in invalid syntax None | None (TypeError: unsupported operand type(s) for |: 'NoneType' and 'NoneType')

And some feature requests:

  • I would like to have an option to generate one file for each input graphql that defines operations, e.g. foo/SomeOperation.graphql -> foo/SomeOperation.py or even better foo/some_operation.generated.py - I'm used to having this from the codegen we use for TypeScript
  • ruff support as an alternative to black

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