Custom Field concatenation without needing external script

I want to store a contact name as it’s separate parts (firstName, middleName, lastName) and then also offer a field that concatenates it altogether. I see that I could do this with a custom field using @custom directive, but that would as well be difficult seeing that:

arguments are not allowed (soon custom field arguments will be allowed and will be used in the @custom directive in the same manner as for custom queries and mutations)
https://graphql.dgraph.io/custom/directive

Is there another way to do this?

I think we have recently merged argument support for @custom in master, but the docs haven’t been updated yet. We will update the docs soon. But, in the meantime if you want to know how arguments work for @custom fields, have a look at the testcases in the codebase on GitHub, particularly on TestCustomLogicGraphqlWithArgumentsOnFields this in the file here

Thank you.

1 Like

There is docs on @custom.

Not complete yet (the feature is still in beta till 20.07.0 is released), but they should also help out.