Skip to content

Commit

Permalink
small style updates
Browse files Browse the repository at this point in the history
  • Loading branch information
koskimas committed Aug 1, 2017
1 parent af2b44b commit dbde5e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/SchemaBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class SchemaBuilder {

expression += relExpr;
++numExpressions;
} else if(selectionNode.kind === 'FragmentSpread') {
} else if (selectionNode.kind === 'FragmentSpread') {
const fragmentSelection = astRoot.fragments[selectionNode.name.value];
const fragmentExpr = this._buildEager(fragmentSelection, modelClass, astRoot);

Expand Down Expand Up @@ -357,15 +357,18 @@ class SchemaBuilder {
const relations = modelClass.getRelations();
const selects = [];

/* Recursively add selects from node */
// Recursively add selects from node
const addSelects = (astNode) => {
for (let i = 0, l = astNode.selectionSet.selections.length; i < l; ++i) {
let selectionNode = astNode.selectionSet.selections[i];
if(selectionNode.kind === 'FragmentSpread') {

if (selectionNode.kind === 'FragmentSpread') {
selectionNode = astRoot.fragments[selectionNode.name.value];
return addSelects(selectionNode);
}

const relation = relations[selectionNode.name.value];

if (!relation) {
selects.push(selectionNode.name.value);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "objection-graphql",
"version": "0.2.1",
"version": "0.2.2",
"description": "Automatically generates GraphQL schema for objection.js models",
"main": "objection-graphql.js",
"scripts": {
Expand Down

0 comments on commit dbde5e5

Please sign in to comment.