这是indexloc提供的服务,不要输入任何密码
Skip to content

behaviour of prefix and suffix in SourceCustomization with naming convention #8544

@paritosh-08

Description

@paritosh-08

Before naming convention was introduced, adding prefix and suffix was pretty straightforward.

For example, say I have a table called foo then HGE generated field names such as foo, foo_by_pk, etc. Now if I want to add prefix while retaining the snakecase of the fields, I would add prefix my_prefix_ and suffix _my_suffix and thus the new field names will be my_prefix_foo_my_suffix, my_prefix_foo_by_pk_my_suffix, etc. (Please note that this is the case with hasura-default naming convention)

With the introduction of graphql-default naming convention, there is no way to add prefix and still retain the case of the field name. For example, if I have a table named foo, the field names generated are foo, fooByPk, etc. Now if I want to add some prefix, say myPrefix, the new fields will be myPrefixfoo, myPrefixfooByPk, etc.

This raises a few questions:

  1. Should hasura change the already generated field names when someone adds a prefix or suffix? i.e. should hasura generate myPrefixFoo, myPrefixFooByPk, etc. in the above example.
  2. If yes, then to be consistent shouldn't hasura also add _ automatically when adding prefix and suffix for hasura-default?

PS: There is a really dirty workaround to fix the prefixing issue by renaming the table to oo and adding prefix myPrefixF, but I don't think anyone should do this.

Metadata

Metadata

Assignees

Labels

k/enhancementNew feature or improve an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions