jhnnsrs / turms

Turms is a pure python implementation of the awesome graphql-codegen library, following a simliar extensible design.
https://jhnnsrs.github.io/turms/
MIT License
62 stars 16 forks source link

Enum keys can conflict with Python Keywords #69

Closed josephlewis42 closed 2 months ago

josephlewis42 commented 10 months ago

I'm generating a client for a GraphQL definition that includes an enumeration with the key None. It appears to be coming from here:

https://github.com/jhnnsrs/turms/blob/1de3aebf828a18d1199a2007006777572124ce12/turms/plugins/enums.py#L81

It seems like doing an iskeyword check similar to this would fix it:

https://github.com/jhnnsrs/turms/blob/1de3aebf828a18d1199a2007006777572124ce12/turms/registry.py#L110

I think any existing places where this is happening would already be producing invalid code so I'm pretty sure the change is non-breaking.

I'm happy to submit a PR if the proposed fix sounds good. WDYT?

Thanks!

jhnnsrs commented 2 months ago

Hey @josephlewis42 I am super sorry, this one completely got lost on the way :-( but is actually resolved now and should work in v.0.6.0. Hope this didn't bother you too long