agoo 2.15.6 → 2.15.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/agoo/sdl.c CHANGED
@@ -1385,6 +1385,16 @@ lookup_field_type(gqlType type, const char *field, bool qroot) {
1385
1385
  return ftype;
1386
1386
  }
1387
1387
 
1388
+ static bool
1389
+ has_all_fields(gqlType type, gqlSel sel) {
1390
+ for (; NULL != sel; sel = sel->next) {
1391
+ if (NULL == lookup_field_type(type, sel->name, false)) {
1392
+ return false;
1393
+ }
1394
+ }
1395
+ return true;
1396
+ }
1397
+
1388
1398
  static int
1389
1399
  make_op(agooErr err, agooDoc doc, gqlDoc gdoc, gqlOpKind kind) {
1390
1400
  char name[256];
@@ -1463,8 +1473,9 @@ make_op(agooErr err, agooDoc doc, gqlDoc gdoc, gqlOpKind kind) {
1463
1473
  gqlType schema = gql_root_type();
1464
1474
  gqlType type = lookup_field_type(schema, kind_str, false);
1465
1475
 
1466
- if ((NULL == lookup_field_type(type, op->sels->name, false)) &&
1467
- (NULL != lookup_field_type(type, name, false))) {
1476
+ if ((NULL != lookup_field_type(type, name, false)) &&
1477
+ !has_all_fields(type, op->sels)) {
1478
+
1468
1479
  gqlSel wrap = sel_create(err, NULL, name, NULL);
1469
1480
 
1470
1481
  if (NULL == wrap) {