From ec1eac50ca383e67feddfa1b674fc888d6b7dde6 Mon Sep 17 00:00:00 2001 From: Kolena Jan Date: Wed, 12 Feb 2020 12:55:23 +0100 Subject: [PATCH] Fix: declare/bind arguments are not strict about keys (they are map in fact) --- core/src/test/resources/application.conf | 2 ++ .../clients/rabbitmq/pureconfig/PureconfigImplicits.scala | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/core/src/test/resources/application.conf b/core/src/test/resources/application.conf index 01976e3a..86538334 100644 --- a/core/src/test/resources/application.conf +++ b/core/src/test/resources/application.conf @@ -191,6 +191,8 @@ myConfig { declareQueue { name = "QUEUE2" + + arguments = { "x-max-length" : 10000 } } bindQueue { diff --git a/pureconfig/src/main/scala/com/avast/clients/rabbitmq/pureconfig/PureconfigImplicits.scala b/pureconfig/src/main/scala/com/avast/clients/rabbitmq/pureconfig/PureconfigImplicits.scala index 59b8bd6a..d10e9cac 100644 --- a/pureconfig/src/main/scala/com/avast/clients/rabbitmq/pureconfig/PureconfigImplicits.scala +++ b/pureconfig/src/main/scala/com/avast/clients/rabbitmq/pureconfig/PureconfigImplicits.scala @@ -59,6 +59,12 @@ class PureconfigImplicits(implicit namingConvention: NamingConvention = CamelCas private implicit def hint[T]: ProductHint[T] = ProductHint[T](ConfigFieldMapping(CamelCase, namingConvention), allowUnknownKeys = allowUnknownKeys) + private implicit val declareArgumentsHint: ProductHint[DeclareArgumentsConfig] = + ProductHint[DeclareArgumentsConfig](ConfigFieldMapping(CamelCase, namingConvention), allowUnknownKeys = true) + + private implicit val bindArgumentsHint: ProductHint[BindArgumentsConfig] = + ProductHint[BindArgumentsConfig](ConfigFieldMapping(CamelCase, namingConvention), allowUnknownKeys = true) + // connection, producer, consumers: implicit val connectionConfigReader: ConfigReader[RabbitMQConnectionConfig] = { if (!allowUnknownKeys) StrictConnectionConfigReader else deriveReader[RabbitMQConnectionConfig]