Skip to main content

Modules and compatibility

Fields v1 separates the validation front ends from the small shared core.

ModulePurposeScala versionsMain external dependencies
fields-coreRules, policies, effects, validation containers, paths, errors, and Circe decoder syntax2.12, 2.13 and 3Circe is optional
fields-valueValue-carrying Field DSL2.12, 2.13 and 3Core only
fields-lensReusable lens/policy DSL and path macros2.12, 2.13 and 3Core only
fields-catsCats Effect, Validated, Chain, Eval, and error-container integration2.12, 2.13 and 3Cats Core
fields-zioZIO effect and validation helpers2.12, 2.13 and 3ZIO 2
fields-zio-blocks-schemaNative ZIO Blocks SchemaError instances and policy-backed schema validation for Value and Lens2.13 and 3Fields Core and ZIO Blocks Schema

Add only the front end and integrations your application uses. Transitive dependencies provide core, but depending on core explicitly is useful when its types are part of your public API.

libraryDependencies ++= Seq(
"io.github.0lejk4" %% "fields-core" % "1.0.0",
"io.github.0lejk4" %% "fields-value" % "1.0.0",
"io.github.0lejk4" %% "fields-lens" % "1.0.0",
"io.github.0lejk4" %% "fields-cats" % "1.0.0", // optional
"io.github.0lejk4" %% "fields-zio" % "1.0.0", // optional
"io.github.0lejk4" %% "fields-zio-blocks-schema" % "1.0.0", // optional integration, Scala 2.13/3
)

Choosing a front end​

  • Choose Value when validation is local and direct access to the current value/path makes rules easiest to write.
  • Choose Lens when policies should be reusable without wrapping the validated model in Field values.

Both use the same core RuleK, PolicyK, Effect, Validated, path, and error concepts.