private static string GetTypeName(GraphQLIntrospectionTypeRef type) { switch (type.Kind) { case GraphQLTypeKind.NonNull: return($"{GetTypeName(type.OfType)}!"); case GraphQLTypeKind.List: return($"[{GetTypeName(type.OfType)}]"); default: return(type.Name); } }
private static bool IsNonNull(GraphQLIntrospectionTypeRef type) { if (type is null) { throw new ArgumentNullException(nameof(type)); } if (IsListType(type)) { return(IsNonNull(type.OfType)); } else { return(type.Kind == GraphQLTypeKind.NonNull); } }
private static bool IsListType(GraphQLIntrospectionTypeRef type) { if (type is null) { throw new ArgumentNullException(nameof(type)); } if (type.Kind == GraphQLTypeKind.List) { return(true); } if (HasSubtype(type.Kind)) { return(IsListType(type.OfType)); } return(false); }
private static GraphQLIntrospectionFullType GetSubtype(GraphQLIntrospectionSchema graphQLIntrospectionSchema, GraphQLIntrospectionTypeRef graphQLIntrospectionTypeRef) { if (graphQLIntrospectionSchema is null) { throw new ArgumentNullException(nameof(graphQLIntrospectionSchema)); } if (graphQLIntrospectionTypeRef is null) { throw new ArgumentNullException(nameof(graphQLIntrospectionTypeRef)); } if (HasSubtype(graphQLIntrospectionTypeRef.Kind)) { return(GetSubtype(graphQLIntrospectionSchema, graphQLIntrospectionTypeRef.OfType)); } return(GetTypeByName(graphQLIntrospectionSchema, graphQLIntrospectionTypeRef.Name)); }