Skip to content

Commit

Permalink
Adding support for dynamic additionalProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
blast-hardcheese committed Oct 24, 2022
1 parent 9458641 commit cc6d79f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit cc6d79f

Please sign in to comment.