private static string? ValidateSerializers()

in src/Epam.Kafka.PubSub/Subscription/Options/SubscriptionOptionsValidate.cs [57:88]


    private static string? ValidateSerializers(SubscriptionOptions options)
    {
        if (options.KeyType != null && options.KeyDeserializer == null &&
            !SerializationHelper.DefaultDeserializers.TryGetValue(options.KeyType, out _))
        {
            return $"Custom deserializer not set for non default key type {options.KeyType}.";
        }

        if (options.ValueType != null && options.ValueDeserializer == null &&
            !SerializationHelper.DefaultDeserializers.TryGetValue(options.ValueType, out _))
        {
            return $"Custom deserializer not set for non default value type {options.ValueType}.";
        }

        try
        {
            if (options.IsTopicNameWithPartition(out _))
            {
                options.GetTopicPartitions();
            }
            else
            {
                options.GetTopicNames();
            }
        }
        catch (ArgumentException e)
        {
            return e.Message;
        }

        return null;
    }