Skip to content

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

Open
emosenkis wants to merge 1 commit intojhnnsrs:mainfrom
emosenkis:patch-2
Open

funcs.md: Fix mistakes and add example.#83
emosenkis wants to merge 1 commit intojhnnsrs:mainfrom
emosenkis:patch-2

Conversation

@emosenkis
Copy link
Copy Markdown
Contributor

No description provided.

@jhnnsrs
Copy link
Copy Markdown
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
Copy Markdown
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