Closed johnhungerford closed 2 years ago
.dsl.{*, given}
imports (e.g., someSchema.updateField method should not be visible without an extension)Another possible pattern
val schema = MyCustomConfiguration.usingDsl { dsl =>
import dsl.{*, given}
schema[ SomeType ]
.product
.addField(field[NestType].fieldName("nested_field").build)
...
.updateComponent("nested_field"/"int_field")(_.withName("int"))
.updateComponent("nested_field"/"str_field")(_.updateSchema(_.genericName("string")))))
.build
}
Builder (only available with extensions in scope):
Schema.buildProduct[T]
Schema.buildCoproduct[T]
Schema.buildDerived[T]
Schema.buildPrimitive[T]
Schema.derived[T] // no need to call .build
Schema.primitive[T](name, description, validators) // no need to call .build
Closed with #29
Standardize methods:
replace
replaces with new (for build only)update
modify via Schema[T] => Schema[T]rebuild
modify via SchemaBuilder[T] => Schema[T]