zio/zio-schema
70.6
Strong · 20 September 2026
39.9k
lines of production code
Scala
primary language
1
measurement over time
What this system is
This system is a schema definition and derivation library for the ZIO ecosystem, enabling the automatic generation of type schemas and associated typeclass instances. It provides a comprehensive suite of binary and text-based codecs for serializing and deserializing data to formats including JSON, Avro, BSON, Protobuf, MessagePack, Thrift, and XML. Additionally, it supports cross-platform execution on JVM, Scala.js, and Scala Native, and includes utilities for generating test data and deriving functional optics from schema definitions.
How it got here
2020–2021 — core feature expansion and ecosystem integration
13 changes.
This period focused on expanding the ZIO Schema library with new serialization modules for Avro, BSON, and Protobuf, alongside advanced schema derivation and utility features like optics and schema comparison. The work also established a robust testing infrastructure, including property-based tests and benchmarks, while introducing automatic test data generation and cross-platform support for Scala 3.
2022–2024 — multi-format codec and platform expansion
16 changes.
This period focused on expanding ZIO Schema's ecosystem by introducing binary codecs for Avro, MessagePack, and BSON, alongside JSON AST support. It also extended platform compatibility to Scala.js and Scala Native and enhanced the derivation system with new typeclasses and macro capabilities. Comprehensive test suites were added to validate these new features and ensure correctness across all supported formats and platforms.
2025–2026 — XML codec addition and Scala 3 test coverage
4 changes.
This period focused on introducing a new zero-dependency XML codec module to zio-schema, complete with comprehensive round-trip encoding and decoding capabilities for diverse schema types. Concurrently, test coverage was expanded to include Scala 3-specific JSON codec features and IArray schema derivation, ensuring robust validation for version-specific functionality.
Features
Add BSON codec support for ObjectId and schema configuration options
The zio-schema-bson module now includes a built-in Schema for MongoDB's ObjectId type, allowing seamless serialization and deserialization of ObjectId values in BSON documents. Additionally, the codec now supports configuration options for controlling how schemas are encoded and decoded, including custom class name mappings, discriminator fields for sum types, and handling of extra fields.
zio-schema-bson · high confidence
Add MessagePack codec support for ZIO Schema
This change introduces a new MessagePack binary codec for ZIO Schema, adding \MessagePackCodec\, \MessagePackEncoder\, and \MessagePackDecoder\ to the \zio-schema-msg-pack\ module. Users can now encode and decode ZIO Schema types to and from MessagePack format, with support for standard primitives, records, sequences, maps, sets, case classes (up to 22 fields), enums, and complex types like \BigDecimal\, \Duration\, \Period\, \YearMonth\, and \MonthDay\.
zio-schema-msg-pack/src/main · high confidence
Add Scala.js and Scala Native support for zio-schema
zio-schema now supports Scala.js and Scala Native platforms. This change introduces platform-specific implementations for \StandardType\ and \SchemaPlatformSpecific\ in the \zio-schema/js\ and \zio-schema/native\ directories, enabling schema serialization and deserialization on these non-JVM targets. The implementation includes support for standard primitive types, Java time types, and currency, with specific handling for platform limitations such as UUID generation and currency default values.
zio-schema/js, zio-schema/native · high confidence
Added JSON encoder and decoder examples for ZIO Schema
The zio-schema-examples module now includes example implementations for encoding and decoding JSON using ZIO Schema. New files, Decoder.scala and Encoder.scala, demonstrate how to derive decoders and encoders from a Schema, converting between JSON structures and ZIO Schema's DynamicValue representation.
zio-schema-examples/shared · high confidence
Added JVM-specific schema support for java.net.URL and java.util.Currency
The zio-schema library now includes platform-specific schema definitions for the JVM, enabling serialization and deserialization of \java.net.URL\ and \java.util.Currency\ types. \URL\ schemas transform between strings and URL objects with validation, while \Currency\ schemas handle default currency resolution based on the JVM's default locale, including error handling for unsupported locales.
zio-schema/jvm · high confidence
Added Scala 2 macro for capturing source location metadata
A new macro implementation has been added to the zio-schema-macros module for Scala 2, enabling the automatic capture of source file path, line number, and column information at compile time. This allows schema definitions to include precise location metadata, which can be useful for debugging, error reporting, or documentation generation.
zio-schema-macros/shared · high confidence
Added automatic derivation of ZIO Test generators for schemas
The \zio-schema-zio-test\ module now includes \DeriveGen\, which automatically derives \zio.test.Gen\ instances for any type that has a \Schema\. This allows users to generate random test data for case classes, enums, primitives, collections, and other schema-supported types without writing manual generators. The change introduces the \DeriveGen.gen\ method and includes comprehensive tests verifying generation for primitives, tuples, options, transforms, lazy schemas, and case classes up to 22 fields.
zio-schema-zio-test/shared · high confidence
Introduction of AvroCodec for encoding and decoding ZIO Schema types
The AvroCodec module has been introduced, providing a new binary codec that allows ZIO Schema types to be encoded to and decoded from the Apache Avro format. This implementation supports encoding and decoding for enums with up to 22 cases, as well as generic records, enabling users to serialize their schema-defined data structures using the Avro standard.
zio-schema-avro/src/main · high confidence
New Avro, BSON, and Derivation modules with benchmark infrastructure
This release introduces dedicated codec modules for Avro and BSON serialization, providing schema encoding/decoding capabilities with specific annotations (e.g., \AvroAnnotations\) and configuration options (e.g., \BsonSchemaCodec.Config\ for sum type handling). It also adds Scala 2 and Scala 3 macro-based schema derivation implementations (\DeriveSchema\, \Derive\) and includes a new benchmark suite for codec performance evaluation.
repository · high confidence
New Factory trait and Deriver typeclass for schema-based derivation
This change introduces a new \Factory\[A\]\ trait and companion object, available for both Scala 2 and Scala 3, which provides a \derive\ method to construct instances of a type \F\[A\]\ using a \Deriver\[F\]\ and an implicit \Schema\[A\]\. It also adds the core \Deriver\[F\]\ trait, defining abstract methods like \deriveRecord\, \deriveEnum\, and \derivePrimitive\ that allow users to build type-class instances automatically from schemas, along with helper methods like \cached\ for performance and \autoAcceptSummoned\ for overriding existing implicits. Additionally, \TupleRecordSchema\ is added to support deriving schemas for tuples up to arity 7, and version-specific \VersionSpecificDeriver\ traits are introduced to handle Scala 2 macro-based and Scala 3 inline-based derivation specifics.
zio-schema-derivation/shared/src/main · high confidence
New ZIO Optics Builder implementation for schema-derived lenses and traversals
The \zio-schema-optics\ module now includes a concrete implementation of the \AccessorBuilder\ trait (\ZioOpticsBuilder\) that derives ZIO optics (lenses, prisms, and traversals) from ZIO schemas. This allows users to automatically generate optics for product records, enum cases, sequences, maps, and sets based on their schema definitions. The implementation uses dynamic values for field access and modification, which simplifies derivation but is noted as not being performant for high-throughput scenarios.
zio-schema-optics/shared/src/main · high confidence
New schema utilities and cross-platform support
This release introduces several new capabilities and structural improvements to the schema library. It adds support for Scala 3's IArray collections, ensuring sequences of immutable arrays are handled correctly. A new \AccessorBuilder\ trait is provided to enable reified optics (lenses, prisms, traversals) for type-safe generic record and enum access. The library now includes a \Differ\ for computing patches between values with a common schema, along with syntax helpers (\diff\, \runPatch\) for easy usage. Schema comparison is now possible via new \SchemaEquality\ and \SchemaOrdering\ traits, allowing schemas to be compared for structural identity or strict equality. Additionally, a \MutableSchemaBasedValueProcessor\ trait is added to facilitate stack-safe, context-aware processing of schema values, and meta-schema rendering is available via \AstRenderer\ for debugging and inspection.
zio-schema/shared/src/main · high confidence
New zero-dependency XML codec module
A new XML codec module has been added to zio-schema, providing zero-dependency serialization and deserialization for XML. This includes an XmlReader for parsing XML strings into an internal AST, an XmlWriter for generating XML strings from the AST with support for indentation and declarations, and an XmlError class for detailed error reporting with line and column information. The module supports round-trip encoding/decoding for various schema types including simple cases, nested structures, optional fields, default values, field name overrides, transient fields, enums (with and without discriminators), attributes, namespaces, collections, maps, recursive structures, Either types, and unit types.
zio-schema-xml/shared · high confidence
Support for zio.json.ast.Json in JSON schema codec
The JSON codec now includes a built-in Schema for zio.json.ast.Json, enabling direct serialization and deserialization of the Json AST type. This allows users to encode and decode dynamic JSON structures without needing custom logic, with the schema annotated for direct dynamic mapping.
zio-schema-json/shared/src/main · high confidence
Test coverage
Added JVM-specific tests for JSON decoding edge cases; Added Protobuf encoding/decoding benchmarks; Added Scala 3-specific JSON codec tests; Added Scala 3-specific tests for schema derivation and typeclass macros; Added comprehensive test coverage for Avro codec encoding and decoding; Added comprehensive test coverage for JSON codec; Added comprehensive test coverage for schema accessors, default values, and dynamic value round-trips; Added comprehensive test coverage for validation logic; Added comprehensive test suite for MessagePack codec; Added comprehensive test suite for ProtobufCodec; Added platform-specific test generators for Scala 3; Added schema comparison assertion utilities; Added test coverage for XML codec with diverse sample resources; Added test coverage for schema derivation and validation; Added tests for Lens optics laws; Added tests for Scala 3 IArray schema derivation; Thrift codec test suite and transport utilities.
Dependencies
Build infrastructure upgraded to SBT 1.13 and Scala 3.9
The project's build system has been updated to SBT 1.13.0, with a comprehensive upgrade of build plugins including sbt-scalajs to 1.22.0, sbt-scala-native to 0.5.12, and zio-sbt-website to 0.8.0. The Scala compiler version has been bumped to 3.9.0, and the build configuration now enforces the Scala 3.3 source level to ensure compatibility with cross-compilation to Scala 2.12 and 2.13. Additionally, dependency versions for core libraries such as ZIO (2.1.26), ZIO-JSON (1.1.0), and Avro (1.12.2) have been synchronized with the latest releases.
project · high confidence
Housekeeping
Initial project scaffolding and configuration
The repository has been initialized with core configuration files, including a Contributor License Agreement (CLA), a comprehensive .gitignore, and build tooling settings such as .jvmopts, .scalafmt.conf (version 3.11.5), and .scalafix.conf. The README.md has been added to document the ZIO Schema library, its installation, and usage examples, while renovate.json is configured for automated dependency updates.
(repo-wide) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 71.
Lenses
- Code Health 79
- Architecture 100
- Maturity 65
- Readiness 83
- Security 65
- Domain Modelling 100
Changes since last survey
- 300 commits — 265 feature/other, 35 fixes
By area
- project/BuildHelper.scala — 74 commits
- project/plugins.sbt — 64 commits
- .github/workflows — 41 commits
- zio-schema-json/shared — 33 commits
- (root) — 29 commits
- project/build.properties — 26 commits
- zio-schema-derivation/shared — 12 commits
- zio-schema-avro/src — 5 commits
- zio-schema-bson/src — 4 commits
- website/docs — 3 commits
- zio-schema/shared — 3 commits
- docs/derivations — 2 commits
- tests/shared — 2 commits
- .github/dependabot.yml — 1 commit
- zio-schema-xml/shared — 1 commit
Notable commits
- fix: Fix #758 by proper decoding of backticked names of fields and classes (#769)
- fix: Fix #794 by updating zio-json to v0.7.6 (#795)
- fix: Fix ClassCastException for hierarchical enum JSON encoding (#970)
- fix: Fix allowing of old class names renamed by caseName annotations in JSON decoders for enums (#775)
- fix: Fix backward binary incompatibility with v1.4.1 version of zio-schema-json (#791)
- fix: Fix build failures in Scala Native modules (#957)
- fix: Fix derivation of JSON encoders for complex cases of sum types (#809)
- fix: Fix duplicated field rejection for JSON codecs of records (#765)
- fix: Fix generation of annotations for enums during schema derivation (#876)
- fix: Fix genericTypeInfo for abstract type parameters in generic schema derivation (#986)
- fix: Fix missing discriminator propagation thorough Schema.Lazy (#807)
- fix: Fix missing field name in an error for duplicated fields (#768)
- fix: Fix pretty printing for JSON encoder of Schema.Fallback (#782)
- fix: Fix publishing to Maven Central (#872)
- fix: Fix remaining inconsistency in JSON codecs for Schema.CaseClass* and Schema.GenericRecord types (#777)
- fix: Fix support of fieldName annotations in JSON codecs for case classes with 1 to 22 fields (#774)
- fix: Fix the stack overflow on creation of JSON codecs for recursive data structures (#760)
- fix: Fix transient field inconsitency in JSON codecs for records (#764)
- fix: Fix unexpected ClassCastException in Schema.serializable (#801)
- fix: Fix using of fieldName annotations to rename fields (not aliasing) (#773)
- …and 280 more
Architecture
- 0 containers · 1 bounded contexts · 0 dependency edges (baseline)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
zio/zio-schema was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit aa7351a6762732116f52f995fd68d87775d86079 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.