feature: Prefix type names
For example, given the schema:
interface A {
id: ID!
}
type B implements A {
id: ID!
b: String!
}
With a prefix of GQL_, would generate:
interface GQL_Aclass GQL_B implements GQL_A
This would help when converting between database, RPC, and GraphQL objects sharing the same name for example
I know #21 and #132 exist, would a PR in the (distant) future be OK?
Thanks @jord1e. Yes, a PR would very much be welcome and appreciated! Now that we have seen a few requests for this feature, it makes sense to add that functionality. Internally, we don't have a use case for this and hence haven't quite prioritized this. But we do welcome any additional support and help from the community.
This is a duplicate of another feature request to add suffixes.: https://github.com/Netflix/dgs-codegen/issues/389
@srinivasankavitha hey! I would like to work on this issue, can you please confirm whether to have them as prefix or suffix?
Thanks for reaching out. As requested, a prefix setting would be great.
Just to confirm: I currently have not made any progress on this and have no plan to do it in the "near" future.
So good luck @vj-codes
The reversal of this feature will also help. It would strip the prefix from the generated type.
For example, given the schema:
interface GQL_A {
id: ID!
}
type GQL_B implements A {
id: ID!
b: String!
}
Without a prefix of GQL_, the plugin would generate:
interface A
class B implements A
This could be useful, when types are prefixed with namespace to avoid type conflicts when the schemas get merged into a federated supergraph.