Exemplo n.º 1
0
        } //method

        public static void ApplyDeep(this GraphQLModelObject modelObj, Action <GraphQLModelObject> action)
        {
            action(modelObj);
            switch (modelObj)
            {
            case ComplexTypeDef ctd: // object type and interface type
                foreach (var fld in ctd.Fields)
                {
                    ApplyDeep(fld, action);
                }
                break;

            case InputObjectTypeDef itd:
                foreach (var f in itd.Fields)
                {
                    ApplyDeep(f, action);
                }
                break;

            case EnumTypeDef etd:
                foreach (var ev in etd.EnumValues)
                {
                    ApplyDeep(ev, action);
                }
                break;

            case ScalarTypeDef _:
            case UnionTypeDef _:
            case InputValueDef _:
                // nothing to do
                break;

            case FieldDef fd:
                if (fd.Args != null)
                {
                    foreach (var a in fd.Args)
                    {
                        ApplyDeep(a, action);
                    }
                }
                break;

            case DirectiveDef dirDef:
                if (dirDef.Args != null)
                {
                    foreach (var a in dirDef.Args)
                    {
                        ApplyDeep(a, action);
                    }
                }
                break;
            } //switch
        }
Exemplo n.º 2
0
 public static bool HasDirectives(this GraphQLModelObject modelObject)
 {
     return(modelObject.Directives != null && modelObject.Directives.Count > 0);
 }