johnhungerford / generic-schema

2 stars 1 forks source link

Method to convert Map[String,N] field to additionalFields in ProductSchemaBuilder #71

Open johnhungerford opened 2 years ago

johnhungerford commented 2 years ago

the goal is to be able to do this:

case class UserData(id: UUID, name: String, data: Map[String, String])

import org.hungerford.generic.schema.Default.dsl.*

val sch = Schema.derivedBuilder[UserData]
                  .additionalFieldsFromField("data")
                  .build

It should be able to remove the field from fieldDescriptions, and use the field's schema as the additionalFieldsSchema.