Example #1
0
        public static string GetGraphQLName(this Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            TypeInfo typeInfo = type.GetTypeInfo();
            string   name     = typeInfo.IsDefined(
                typeof(GraphQLNameAttribute), false)
                                ? typeInfo.GetCustomAttribute <GraphQLNameAttribute>().Name
                                : GetFromType(typeInfo);

            return(NameUtils.RemoveInvalidCharacters(name));
        }