type_fields(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel sel, gqlValue result, int depth) {
    gqlType		type = (gqlType)obj->ptr;
    const char		*key = sel->name;
    gqlField		f;
    gqlValue		list;
    gqlValue		co;
    struct _gqlField	cf;
    struct _gqlCobj	child = { .clas = &field_class };
    int			d2 = depth + 1;
    gqlValue		a = gql_extract_arg(err, field, sel, "includeDeprecated");
    bool		inc_dep = false;

    if (NULL != sel->alias) {
	key = sel->alias;
    }
    if (GQL_OBJECT != type->kind && GQL_SCHEMA != type->kind && GQL_INTERFACE != type->kind) {
	if (NULL == (list = gql_null_create(err)) ||
	    AGOO_ERR_OK != gql_object_set(err, result, key, list)) {
	    return err->code;
	}
	return AGOO_ERR_OK;
    }
    if (NULL == (list = gql_list_create(err, NULL)) ||
	AGOO_ERR_OK != gql_object_set(err, result, key, list)) {
	return err->code;
    }
    if (NULL != a && GQL_SCALAR_BOOL == a->type->scalar_kind && a->b) {
	inc_dep = true;
    }
    memset(&cf, 0, sizeof(cf));
    cf.type = sel->type->base;
    for (f = type->fields; NULL != f; f = f->next) {
	if (!inc_dep && is_deprecated(f->dir)) {
	    continue;
	}
	if (NULL == (co = gql_object_create(err)) ||
	    AGOO_ERR_OK != gql_list_append(err, list, co)) {
	    return err->code;
	}
	child.ptr = f;
	if (AGOO_ERR_OK != gql_eval_sels(err, doc, (gqlRef)&child, &cf, sel->sels, co, d2)) {
	    return err->code;
	}
    }
    return AGOO_ERR_OK;
}
type_fields(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel sel, gqlValue result, int depth) {
    gqlType		type = (gqlType)obj->ptr;
    const char		*key = sel->name;
    gqlField		f;
    gqlValue		list;
    gqlValue		co;
    struct _gqlField	cf;
    struct _gqlCobj	child = { .clas = &field_class };
    int			d2 = depth + 1;
    gqlValue		a = gql_extract_arg(err, field, sel, "includeDeprecated");
    bool		inc_dep = false;

    if (NULL != sel->alias) {
	key = sel->alias;
    }
    if (GQL_OBJECT != type->kind && GQL_SCHEMA != type->kind && GQL_INTERFACE != type->kind) {
	if (NULL == (list = gql_null_create(err)) ||
	    AGOO_ERR_OK != gql_object_set(err, result, key, list)) {
	    return err->code;
	}
	return AGOO_ERR_OK;
    }
    if (NULL == (list = gql_list_create(err, NULL)) ||
	AGOO_ERR_OK != gql_object_set(err, result, key, list)) {
	return err->code;
    }
    if (NULL != a && GQL_SCALAR_BOOL == a->type->scalar_kind && a->b) {
	inc_dep = true;
    }
    memset(&cf, 0, sizeof(cf));
    cf.type = sel->type->base;
    for (f = type->fields; NULL != f; f = f->next) {
	if (!inc_dep && is_deprecated(f->dir)) {
	    continue;
	}
	if (NULL == (co = gql_object_create(err)) ||
	    AGOO_ERR_OK != gql_list_append(err, list, co)) {
	    return err->code;
	}
	child.ptr = f;
	if (AGOO_ERR_OK != gql_eval_sels(err, doc, (gqlRef)&child, &cf, sel->sels, co, d2)) {
	    return err->code;
	}
    }
    return AGOO_ERR_OK;
}