Mapping fields name
neoPix opened this issue · comments
David B. commented
Hi,
Is there a way to map the fields (eg. _id => id) and vice versa ?
Something like this :
createType({
name: 'User',
description: 'an application user',
class: 'GraphQLObjectType',
schema: User,
map: {
displayName: 'name',
'_id': 'id'
},// or Map, or func
exclude: ['auths']
})
Thanks.
Sarkis commented
Hi, sorry for late response. it is a good idea, right now you can use workaround for example:
createType({
name: 'User',
description: 'an application user',
class: 'GraphQLObjectType',
schema: User,
exclude: ['_id'],
extend: {
id: {type: GraphQLInt},
},
})
but you can anytime submit PR or I can add that function but can't give any timelines, pretty busy right now.