import { makeExecutableSchema } from 'graphql-tools';
const fish = { length:50 },
rope = { length:100 };
const typeDefs = `
type Query {
rope: Rope!
fish: Fish!
}
type Mutation {
increase_fish_length: Fish!
increase_rope_length: Rope!
}
type Rope {
length: Int!
}
type Fish {
length: Int!
}
`;
const resolvers = {
Mutation: {
increase_fish_length: (root, args, context) => {
fish.length++;
return fish;
},
increase_rope_length: (root, args, context) => {
rope.length++;
return rope;
}
}
};
export const schema = makeExecutableSchema({ typeDefs, resolvers });
Above example is working well, but I want to use a mutation name increase_length instead of increase_fish_length and increase_rope_length.
I tried to name mutations Fish/increase_length and Rope/increase_length using slash, but it didn't work. (only /[_A-Za-z][_0-9A-Za-z]*/ are available.)
Dose GraphQl support any solution for namespace?