Iltotore/iron
63.3
Adequate · 20 September 2026
4.5k
lines of production code
Scala
primary language
1
measurement over time
What this system is
This is a Scala library that provides compile-time and runtime type refinement, allowing developers to attach constraints to types to ensure data validity. It integrates with a wide ecosystem of serialization, configuration, and validation libraries—including Circe, Play JSON, ZIO, Cats, and Doobie—to automatically enforce these constraints during decoding, parsing, and database operations. The system supports cross-compilation for JVM, Scala.js, and Scala Native, offering a unified approach to building robust, type-safe applications.
How it got here
2022 — Mill migration and ecosystem integrations
13 changes.
The project was bootstrapped with the Mill build system and Scala 3, while refining the core RefinedType behavior to no longer act as a subtype of its base type. Significant effort was directed toward expanding the library's ecosystem support by adding integration modules for Cats, Play JSON, jsoniter, and scodec, alongside comprehensive test coverage and usage examples.
2023 — ecosystem integration modules
11 changes.
This period focused on expanding the library's ecosystem by adding integration modules for popular Scala libraries including ZIO, ScalaCheck, PureConfig, Ciris, uPickle, Skunk, and Decline. Each feature addition was accompanied by comprehensive test coverage to ensure that constraint validation and type handling worked correctly within these external contexts.
2024–2026 — expansion of third-party library integrations
12 changes.
This period focused on extending the library's ecosystem by adding integration modules for serialization, database, and schema libraries including Borer, Chimney, Dynosaur, and ZIO Blocks. Comprehensive test suites were implemented for all new integrations as well as existing ones like Circe, ZIO-JSON, Doobie, and Play-JSON to ensure correct typeclass resolution and validation error handling.
Features
Add Borer serialization example for iron constraints
The examples/borerSerialization directory now includes a working demonstration of integrating the iron constraint library with the Borer serialization library. The new Account.scala file defines typed constraints for username, password, and age, deriving Borer codecs to handle serialization and validation. The main.scala file provides a runnable example that encodes an Account instance to JSON and decodes it back, including handling of validation failures when decoding invalid data.
examples/borerSerialization · high confidence
Add HTTP form validation example using Iron and Cats
Added a new example demonstrating how to use Iron constraints with Cats and http4s to validate form data in a web service. The example defines an Account model with specific constraints (alphanumeric username, password complexity, positive age) and implements an HTTP server that decodes JSON requests, validates them using Iron's refinement capabilities integrated with Cats' validation types, and returns appropriate HTTP responses for success or validation failures.
examples/formCats · high confidence
Add Iron integration for Dynosaur schema derivation
The dynosaur module now provides built-in support for the Iron library, allowing users to automatically derive schemas for types refined with Iron constraints. This integration ensures that validation errors from Iron refinements are correctly mapped to Dynosaur's ReadError type, enabling seamless schema generation for constrained data types without manual implementation.
dynosaur · high confidence
Add Play JSON serialization support for refined types
Users can now serialize and deserialize refined types using the Play JSON library. This change introduces implicit Reads and Writes instances that handle the decoding of JSON into the underlying type and validate it against the refinement constraint, returning a JsError if the constraint fails, while serialization simply delegates to the underlying type's writer.
circe, playJson, zioJson · high confidence
Add PureConfig integration for refined and new types
Users can now load configuration files using PureConfig with refined types (e.g., \A :\| C\) and new types defined via the library's \RefinedType\. The new \pureconfig.scala\ module provides \ConfigReader\ instances that decode values from configuration sources and automatically validate them against their constraints, failing with a descriptive \RefinedConfigError\ if validation fails. This includes support for maps with refined keys and values, as well as new types derived from underlying configuration readers.
ciris, pureconfig · high confidence
Add ZIO Blocks Schema integration for Iron constraints
This change introduces a new \zioBlocksSchema\ module that bridges Iron's compile-time constraints with ZIO Blocks' schema system. It provides a lossless translation of supported Iron constraints (such as numeric ranges, string lengths, and pattern matches) into ZIO Blocks' validation AST via a new \ZioBlocksValidation\ trait and its macro implementation. Users can now generate ZIO Blocks schemas from Iron-refined types, with options to either embed these constraints directly into the schema (\EmbedSupported\) or rely solely on Iron's runtime validation (\RuntimeOnly\), while also optionally preserving Iron's constraint messages as schema metadata.
zioBlocksSchema · high confidence
Add ZIO integration module
Introduces a new ZIO module that provides extension methods for refining values and collections using ZIO's Validation effect type. This includes \refineValidation\ and \refineAllValidation\ for applicative runtime refinement, as well as \refineFurtherValidation\ and \refineAllFurtherValidation\ to chain additional constraints. The module also exposes \validation\ and \validationAll\ methods on existing Refined types and provides ZIO prelude typeclass instances (Debug, Equal, Ord, Hash) for refined types.
zio · high confidence
Add ZIO-based form validation example
A new example project demonstrating how to use the library with ZIO and ZIO HTTP. It includes an Account model with constrained fields (username, password, age) and a simple HTTP server that validates incoming JSON requests against these constraints, returning a bad request response if validation fails.
examples/formZio · high confidence
Add iron-borer integration module
A new integration module for the Borer serialization library has been added, providing automatic Encoder and Decoder instances for refined types. This allows users to seamlessly serialize and deserialize types constrained by the iron library using Borer, with validation failures during decoding properly propagated as validation errors.
borer · high confidence
Add jsoniter integration for refined types
A new integration module for \jsoniter-scala\ has been added, providing automatic JSON serialization and deserialization support for refined types. This change introduces inline codecs that validate decoded values against their constraints and seamlessly encode refined types, allowing users to leverage \jsoniter\ with the library's type refinement features.
doobie, jsoniter, scodec · high confidence
Add jsoniter-scala integration example for Iron constraints
The examples/formJsoniter module now includes a demonstration of integrating the Iron library with jsoniter-scala. It provides an Account case class with constrained fields (username, password, age) and shows how to use jsoniter's JsonCodecMaker to serialize and deserialize these validated types, including handling of invalid JSON inputs.
examples/formJsoniter · high confidence
Add support for Decline command-line argument parsing
The library now provides integration with the Decline library for parsing command-line arguments. This change adds implicit \Argument\ instances that allow refined types (e.g., \A :\| B\) and new types to be directly read from command-line strings. The implementation validates the input against the specified constraints during parsing, ensuring that only values satisfying the refinement rules are accepted, and returns appropriate validation errors if the constraints are violated.
decline · high confidence
Add uPickle serialization support for refined types
Users can now serialize and deserialize iron-refined types using the uPickle library. This change introduces implicit Reader and Writer instances that handle the encoding and decoding of refined types, ensuring that constraints are validated during deserialization.
upickle · high confidence
Chimney integration for refined types
Added integration with the Chimney library to enable automatic transformation between refined types and their raw counterparts. This allows users to seamlessly convert between refined types and raw values using Chimney's Transformer and PartialTransformer mechanisms, supporting both safe partial transformations with validation and direct conversions where constraints allow.
chimney, skunk · high confidence
Introduce ScalaCheck integration for property-based testing
Adds a new \scalacheck\ module providing \Arbitrary\ instances for Iron-constrained types, enabling property-based testing. The module includes generators for numeric constraints (intervals, greater/less than), collection constraints (length, emptiness, containment), string constraints (prefix/suffix, length), and character constraints (whitespace, case, digits). It also supports union constraints and provides helper traits like \Adjacent\ and \Min\/\Max\ to ensure generated values strictly satisfy boundary conditions.
scalacheck · high confidence
New Cats integration with runtime refinement and bounded algebraic instances
The \cats\ module now provides a comprehensive integration with the Cats library, introducing runtime refinement methods (\refineNec\, \refineNel\, \refineValidated\, etc.) that allow values to be validated and wrapped in Cats error types like \EitherNec\ or \Validated\. It also adds \refineFurther\ methods to chain additional constraints on already refined types, and \refineAll\ methods to apply constraints across traversable collections. Furthermore, the module supplies Cats typeclass instances (\Eq\, \Order\, \Show\, \Hash\) for refined types, and implements \CommutativeSemigroup\ and \CommutativeMonoid\ instances for bounded numeric types (e.g., \Positive\, \Negative\) that automatically shift values back into bounds when algebraic operations would otherwise violate constraints.
cats · high confidence
New modular constraint library with type-specific validation rules
The constraint validation logic has been reorganized into distinct modules (\any\, \char\, \collection\, \numeric\, \string\) and re-exported via a unified \all\ object. This structure introduces specific constraints for characters (e.g., \Digit\, \Letter\), collections (e.g., \Length\, \Contain\), numbers (e.g., \Greater\, \Less\, \Interval\), and strings (e.g., \ValidURL\, \ValidEmail\, \StartWith\), alongside generic operators like \Xor\ and \DescribedAs\. Users can now import only the constraint categories they need or use the aggregate \all\ object for full access.
main/src/io/github/iltotore/iron/constraint · high confidence
Project bootstrapped with Mill 0.12.14 and Scala 3.3.6
The repository has been initialized with a new build system using Mill version 0.12.14 (specified in \.mill-version\) and the \build.sc\ build definition. The project is configured to compile against Scala 3.3.6 and supports cross-compilation for JVM, Scala.js, and Scala Native. Additionally, the repository now includes standard project infrastructure files such as \.gitignore\, \LICENSE\ (Apache 2.0), \README.md\, and documentation links for Code of Conduct and Contributing guidelines.
(repo-wide) · high confidence
Behavioural changes
Configurable and improved compile-time error diagnostics
The macro system now supports configurable compile-time error reporting, allowing users to control the verbosity and formatting of constraint violation messages via system properties or environment variables (e.g., \iron.shortMessages\, \iron.color\). This change introduces a new internal configuration mechanism that enables shorter, more concise error messages for better integration with IDE error lenses, while also providing detailed, colorized, and structured diagnostic output by default to help users quickly identify which specific constraints failed and why.
main/src/io/github/iltotore/iron/macros · high confidence
RefinedType no longer acts as a subtype of its base type
The \RefinedType\ implementation has been changed so that the refined type is no longer a subtype of the underlying base type. This behavioral change means that implicit conversions or subtyping expectations where a refined value was previously accepted as its base type will no longer work automatically; users must now explicitly unwrap or cast the value if the base type is required.
main/src/io/github/iltotore/iron · high confidence
Test coverage
Added ScalaCheck test suites for Iron constraints; Added ZIO integration tests for RefinedType and RefinedSubtype; Added comprehensive test coverage for iron constraints and refined types; Added test coverage for Cats integration and numeric shift operations; Added tests for Chimney integration and PartialTransformer derivation; Added tests for Circe and ZIO-JSON integration with RefinedSubtype; Added tests for Ciris integration; Added tests for Decline integration with iron constraints; Added tests for Doobie integration with iron types; Added tests for Iron integration with Dynosaur; Added tests for Play-JSON integration; Added tests for Skunk codec integration with refined types; Added tests for ZIO Blocks Schema integration with Iron constraints; Added tests for scodec integration with refined types; Added tests for upickle integration with RefinedOps types.
Housekeeping
Added empty source directory placeholder
An empty .gitkeep file was added to the sandbox/src directory to ensure the directory is tracked by version control.
sandbox · 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 63.
Lenses
- Code Health 93
- Architecture 100
- Maturity 59
- Readiness 56
- Security 70
Changes since last survey
- 300 commits — 253 feature/other, 47 fixes
By area
- main/src — 87 commits
- (root) — 80 commits
- docs/_docs — 44 commits
- .github/workflows — 30 commits
- cats/src — 10 commits
- main/docs — 6 commits
- main/test — 6 commits
- scalacheck/src — 6 commits
- (repo) — 4 commits
- borer/test — 3 commits
- examples/formJsoniter — 2 commits
- examples/formZio — 2 commits
- scalacheck/test — 2 commits
- zioBlocksSchema/src — 2 commits
- .github/ISSUE_TEMPLATE — 1 commit
- .github/PULL_REQUEST_TEMPLATE — 1 commit
- .github/dependabot.yml — 1 commit
- borer/src — 1 commit
- cats/test — 1 commit
- chimney/src — 1 commit
Notable commits
- fix: fix: Add a missing space in MaxLength description (#101)
- fix: fix: Allow port number in URL constraint (#87)
- fix: fix: Allow runtime usage of Greater/Less constraints
- fix: fix: Already completed TODO in ops.scala
- fix: fix: Ambiguous given instance inside RefinedTypeOps (#180)
- fix: fix: Ambiguous implicit for automatic refinement
- fix: fix: Ambiguous implicit for automatic refinement (#76)
- fix: fix: Ambiguous implicit when both Eq[A] and Hash[A] are available (#162)
- fix: fix: Bad quoting in release.yml (#97)
- fix: fix: Broken link for CODE_OF_CONDUCT.md and CONTRIBUTING.md
- fix: fix: Broken logo link
- fix: fix: Change color of error message (#233)
- fix: fix: Code snippets in README and website (#100)
- fix: fix: De-inline given instances (#328)
- fix: fix: DescribedAs Implication ambiguity (#314)
- fix: fix: Forgotten permissions in publish CD
- fix: fix: Handle init/tail of empty String (#309)
- fix: fix: Impossible runtime evaluation of Greater and Less
- fix: fix: Incorrect permissions for GH Pages
- fix: fix: Inline value in union/intersection constraint implementation (#337)
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
Iltotore/iron 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 b8bdda9f2f4cc3a77acfb5171614bf78644c56e2 — 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.