in src/schemaModelValidator.js [96:134]
function injectChanges(schemaModel) {
let r = '';
let stringModel = schemaStringify(schemaModel, true);
stringModel += '\n';
typesToAdd.forEach(type => {
stringModel += '\n' + type + '\n';
});
if (!stringModel.includes('type Query {'))
stringModel += '\ntype Query {\n}\n';
if (!stringModel.includes('type Mutation {'))
stringModel += '\ntype Mutation {\n}\n';
if (!stringModel.includes('schema {'))
stringModel += '\nschema {\n query: Query\n mutation: Mutation\n}\n';
const lines = stringModel.split('\n');
lines.forEach(line => {
r += line + '\n';
if (line.includes('type Query {')) {
queriesToAdd.forEach(query => {
r += " " + query;
});
}
if (line.includes('type Mutation {')) {
mutationsToAdd.forEach(mutation => {
r += " " + mutation;
});
}
});
return gql(r);
}