diff --git a/modules/core/src/main/scala/dev/guardrail/generators/ProtocolGenerator.scala b/modules/core/src/main/scala/dev/guardrail/generators/ProtocolGenerator.scala index e78b77ac64..57165fef81 100644 --- a/modules/core/src/main/scala/dev/guardrail/generators/ProtocolGenerator.scala +++ b/modules/core/src/main/scala/dev/guardrail/generators/ProtocolGenerator.scala @@ -429,6 +429,16 @@ object ProtocolGenerator { .orRefine { case s: StringSchema if Option(s.getEnum).map(_.asScala).exists(_.nonEmpty) => s }(s => fromEnum(nestedClassName.last, s, dtoPackage, components).map(Option(_)) ) + .orRefine { case m: MapSchema => m } { m => + m.downField("additionalProperties", _.getAdditionalProperties) + .indexedDistribute + .flatTraverse( + _.refine { case x: ObjectSchema => x }(obj => + fromModel(nestedClassName, obj, List.empty, concreteTypes, definitions, dtoPackage, supportPackage, defaultPropertyRequirement, components) + ).toOption.sequence + ) + .widen + } .getOrElse(Option.empty[Either[String, NestedProtocolElems[L]]].pure[F]) } yield defn