insolite / graphene-peewee-async

Graphene peewee-async integration
37 stars 9 forks source link

Relation name is strange #4

Closed art1415926535 closed 6 years ago

art1415926535 commented 6 years ago

If we hawe model with

field = ForeignKeyField(SomeModel, related_name='some_name')

then connection of this relation will be named like SomeModel_some_name_Connection I think SomeModel_SomeName_Connection will sound better .

insolite commented 6 years ago

First off, you're absolutely right about non-consistent naming. But converting snake-case into camel-case may end up in naming conflicts as peewee field names are case sensitive as well as some DBMS's. For example:

Name => Name
name => Name

or even:

SomeName => SomeName
some_name => SomeName

Although that is not a common case for systems built in a proper way, we should really consider if the naming of connections really worth introducing that kind of potential issue. In my own practice of "client-side" usage I can't remember cases where I should deal with connection names, so I didn't care about good loking naming. So, @art1415926535, what is your particular case of usage? Maybe we could introduce more ideas if that really matters.

art1415926535 commented 6 years ago

In my own practice too. But looking at the structure in GraphiQL... It's not beautiful. Although mixing snake-case and camel-case is also not good. Ok. You may reject PR.