Skip to content
CAI
Software that uses CAICheck a score

kitlangton/neotype

60.9

Adequate · 20 September 2026

9.6k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Neotype is a Scala library that provides zero-overhead newtypes and subtypes with optional compile-time or runtime validation. It offers a comprehensive ecosystem of interop modules for popular libraries including Tapir, Caliban, Circe, ZIO, Doobie, and various JSON and configuration parsers. The system ensures data integrity by automatically enforcing type constraints during serialization, deserialization, and database operations while maintaining type safety.

How it got here

2023 — Scala 3 upgrade and API consolidation

7 changes.

The project upgraded to Scala 3.3.8 and overhauled its core architecture by removing the legacy compile-time validation engine in favor of a unified WrappedType typeclass. This consolidation streamlined interop modules for ZIO JSON and Quill, while introducing structured error reporting and comprehensive test coverage for the new validation semantics.

2024 — Ecosystem integration and standard types

8 changes.

This period focused on expanding Neotype's ecosystem compatibility by adding interop modules for major Scala libraries including Caliban, Tapir, Circe, Doobie, and ZIO Schema. The work also introduced a standardized test infrastructure for JSON serialization and a collection of pre-defined validated types for common string, numeric, and network use cases.

2025 — Interop modules and compile-time expansion

9 changes.

This period focused on expanding the Neotype ecosystem by adding interop modules for major serialization and configuration libraries, including upickle, Ciris, Pureconfig, Scanamo, Tethys, and Cats. Concurrently, the comptime module was significantly enhanced with file I/O, union types, and mutable state support, while new examples demonstrated these compile-time capabilities alongside JVM-specific zero-overhead verification.

Features

Add Caliban and Tapir interop support for neotype

New interop modules for Caliban and Tapir have been added, enabling seamless integration of neotype's validated newtypes and subtypes with these libraries. The Caliban integration provides automatic Schema and ArgBuilder derivation, ensuring that GraphQL schemas correctly reflect neotype types and that input validation errors are propagated as execution errors. The Tapir integration adds Schema, Codec, and Pickler instances that preserve neotype validation rules during serialization, deserialization, and schema validation, allowing API endpoints to reject invalid inputs with the same constraints defined in the neotype.

modules/neotype-caliban, modules/neotype-tapir · high confidence

Add Chimney interop for Neotype transformations

Users can now transform between Neotype newtypes/subtypes and their underlying types, or between different Neotype wrappers, using the Chimney library. This new module provides implicit transformers for simple, validated, and subtype definitions, enabling seamless conversion (including partial transformations that respect validation rules) via Chimney's DSL.

modules/neotype-chimney · high confidence

Add Circe and ZIO Config interop support for wrapped types

New interop modules for Circe and ZIO Config now automatically handle Neotype wrapped types during JSON serialization/deserialization and configuration loading. This ensures that validation rules defined on wrapped types (such as newtypes and subtypes) are preserved when decoding JSON or reading configuration maps, including support for wrapped map keys where validation errors are correctly reported.

modules/neotype-circe, modules/neotype-zio-config · high confidence

Add Pureconfig integration for Neotype

Users can now load Neotype instances directly from configuration files using Pureconfig. This change introduces a new interop module that provides a ConfigReader instance for Neotype types, allowing seamless deserialization of validated newtypes and subtypes from configuration sources.

modules/neotype-pureconfig · high confidence

Add Scanamo interop for DynamoDB serialization

Users can now seamlessly serialize and deserialize Neotype newtypes and subtypes to and from DynamoDB using Scanamo. This change introduces a new \DynamoFormat\ instance that automatically unwraps Neotype values for writing and validates them upon reading, ensuring that type constraints (such as non-empty strings or length requirements) are enforced during deserialization from DynamoDB items.

modules/neotype-scanamo · high confidence

Add Tethys JSON serialization interop

Users can now serialize and deserialize Neotype wrapped types using the Tethys JSON library. This change introduces \JsonReader\ and \JsonWriter\ instances that automatically handle validation during deserialization (via \make\) and unwrapping during serialization (via \unwrap\), allowing seamless integration of Neotype types with Tethys-based JSON processing.

modules/neotype-tethys · high confidence

Add upickle serialization support for Neotype wrappers

Users can now serialize and deserialize Neotype validated and simple wrapper types using the upickle library. This new interop module provides Reader, Writer, and ReadWriter instances that handle validation errors during deserialization by throwing upickle Abort exceptions, and correctly unwraps values during serialization.

modules/neotype-upickle · high confidence

Added Cats interop for Show, Eq, and Order on newtypes

Users can now leverage Cats typeclasses directly on Neotype newtypes. The module provides automatic derivation for Show, Eq, and Order instances by unwrapping the newtype to its underlying value, enabling seamless integration with Cats-based libraries and idioms for simple newtypes, subtypes, and stacked newtypes.

modules/neotype-cats · high confidence

Added ZIO Schema interop support for Neotype wrappers

Users can now seamlessly integrate Neotype newtypes with ZIO Schema for automatic JSON encoding and decoding. This change introduces \ZioSchemaInstances\ which provide \Schema\ derivations for both \ValidatedWrappedType\ and \SimpleWrappedType\ Neotype wrappers, allowing them to be serialized and deserialized via ZIO's JSON codec without manual boilerplate. Comprehensive tests verify that validation rules (such as non-empty strings and length constraints) are correctly enforced during JSON parsing failures.

modules/neotype-zio-schema · high confidence

Added common validated string, numeric, and network types

The \neotype.common\ package now provides a set of pre-defined, validated types for common use cases. This includes string types such as \NonEmptyString\, \UriString\, \UuidString\, \HexString\, and \EmailString\, as well as numeric types like \PositiveInt\, \NonNegativeInt\, \NegativeInt\, \PositiveLong\, \NonNegativeLong\, \NegativeLong\, \PositiveDouble\, \NonNegativeDouble\, \Percentage\, and \UnitInterval\. Additionally, a \PortNumber\ type is available for validating network port integers within the 0-65535 range. These types enforce their constraints at compile-time or runtime via inline validation, ensuring data integrity for these specific formats.

modules/core/shared/src/main/scala/neotype/common · high confidence

Expanded compile-time evaluation with file I/O, union types, and mutable state

The comptime module now supports reading files at compile time via \comptime.readFile\ and \comptime.readFileBytes\, allowing source content to be embedded as constants. Union types (e.g., \String \| Boolean\) are now supported for validation patterns, and local mutable variables (\var\) are allowed within comptime blocks. The standard library coverage has been significantly broadened to include \String.getBytes\, \Array.fill\/\tabulate\, and extensive collection operations, while error reporting for file operations now provides clear snapshots for missing files and unsupported encodings.

modules/comptime · high confidence

JVM-specific newtype validation and zero-overhead verification

This change introduces JVM-specific implementations and comprehensive tests for the neotype library. It adds a \UrlString\ subtype in the common module that validates inputs using \java.net.URI\, ensuring only valid URLs are accepted. Additionally, it includes a suite of tests (\ZeroOverheadSpec\, \BytecodeInspectionTarget\) to verify that newtypes maintain zero runtime overhead by preserving primitive types and avoiding boxing, alongside snapshot tests for validation error messages.

modules/core/jvm · high confidence

New Ciris interop module for configuration decoding

A new interop module has been added to integrate the Ciris configuration library with Neotype. This addition provides \ConfigDecoder\ instances that allow Ciris to automatically decode configuration values into Neotype's \ValidatedWrappedType\ and \SimpleWrappedType\ wrappers, ensuring that validation rules defined in Neotype are enforced during configuration loading. Tests confirm that both successful decodings and validation failures (such as empty strings or length constraints) are correctly handled.

modules/neotype-ciris · high confidence

New Doobie interop module with support for stacked and composite newtypes

A new \neotype-doobie\ module has been added to provide seamless database integration for Neotype newtypes and subtypes. This module supplies Doobie \Get\, \Put\, \Read\, and \Write\ typeclass instances that automatically unwrap and re-wrap values, ensuring that validation rules defined in Neotype are enforced during database reads and writes. It specifically supports stacked newtypes (e.g., a newtype wrapping another newtype) and composite types, allowing complex domain models to be persisted and retrieved safely. The implementation includes handling for array types and ensures that invalid data from the database triggers appropriate failures rather than silently corrupting the domain model.

modules/neotype-doobie · high confidence

New compile-time example projects for static assertions, newtypes, and parsed types

The examples directory now includes four new Scala files demonstrating compile-time capabilities. ComptimeExamples.scala shows how to use the comptime macro for pre-computed lookup tables (primes, factorials) and static assertions to validate configuration invariants (buffer, pool, rate-limit, video settings) at compile time. NewtypeExamples.scala demonstrates the neotype library for creating zero-cost newtypes and subtypes with compile-time validation (ports, emails, usernames, hex colors) and runtime construction. ParsedExamples.scala and ParsedTypes.scala together show compile-time string parsing into structured types (SemVer, IPv4, RGB, SimpleDuration) with both compile-time literal validation and runtime Either-based parsing.

examples · high confidence

New interop modules for JSON serialization and ZIO test generation

This change introduces three new modules to the neotype library: \neotype-jsoniter\, \neotype-play-json\, and \neotype-zio-test\. The JSON modules provide serialization and deserialization support for Neotype newtypes using the Jsoniter and Play JSON libraries, handling both validated and simple wrapped types. The ZIO test module adds support for generating test data (\DeriveGen\) for simple newtypes within the ZIO Test framework. These additions expand the ecosystem compatibility of Neotype, allowing users to seamlessly integrate newtypes with popular Scala JSON libraries and testing tools.

modules/neotype-jsoniter, modules/neotype-play-json, modules/neotype-zio-test · high confidence

Repository setup and documentation overhaul

The repository has been initialized with a comprehensive documentation structure, including a new README detailing features, integrations (such as zio-json, circe, and tapir), and a comptime module, alongside new AGENTS.md and CLAUDE.md developer notes. The project now supports Nix-based development environments via flake.nix and flake.lock, and enforces code formatting using scalafmt 3.8.5. Additionally, the project is now licensed under the Apache License 2.0, and CI badges have been updated to point to Maven Central instead of Sonatype snapshots.

(repo-wide) · high confidence

Removals

Removal of core compile-time validation engine

The core compile-time validation engine has been removed from the \modules/core/src\ package. This change deletes the \Calc\ expression AST and its associated rendering and evaluation logic, the \Macros\ object that performed compile-time validation, the \ErrorMessages\ helper for generating user-facing error text, and the \StringFormatting\ utilities. Consequently, the \Newtype\, \Subtype\, and \Wrapper\ trait definitions in \package.scala\ are also removed, eliminating the library's ability to validate newtypes at compile time.

modules/core/src · high confidence

Behavioural changes

Consolidated Quill interop using unified WrappedType

The Quill integration module has been restructured to support the new unified Newtype architecture. The previous implementation, which required separate implicit conversions for Newtype, Newtype.Simple, Subtype, and Subtype.Simple, has been replaced by a single set of MappedEncoding instances based on the WrappedType typeclass. This change simplifies the API by allowing Newtype to be defined as a plain object with optional validation, subsuming the previous Simple type distinction. Users benefit from a cleaner, more consistent interop layer that automatically handles both validated and simple newtypes through the same WrappedType mechanism.

modules/neotype-zio-quill · high confidence

Refactored ZIO JSON interop to support Validated and Simple wrappers

The ZIO JSON integration module has been restructured to provide dedicated instances for \ValidatedWrappedType\ and \SimpleWrappedType\, replacing the previous monolithic definitions that handled \Newtype\ and \Subtype\ directly. This change updates how JSON encoding and decoding are derived for these wrapper types, ensuring that validation logic is correctly applied during deserialization for validated wrappers while maintaining efficient serialization for simple wrappers. Existing tests have been migrated to verify this new behavior, including specific checks that custom codecs take precedence over the imported interop definitions.

modules/neotype-zio-json · high confidence

Structured compile-time error reporting and validation API updates

The neotype core module now provides detailed, structured error messages for compile-time validation failures, including specific guidance for input parsing issues, validation rejections, and unsupported macro expressions. The \validate\ method's return type has been expanded to support returning a custom error message (String) in addition to a boolean, allowing for more descriptive failure feedback. New utility classes \IsSimpleType\ and \IsValidatedType\ have been introduced to distinguish between newtypes with and without validation logic at compile time. Additionally, the \Newtype\ and \Subtype\ base classes now expose \makeOrThrow\ for convenient runtime validation in tests, and the \TypeWrapper\ base class includes \unsafeMake\ and \unsafeMakeF\ methods to bypass validation when necessary.

modules/core/shared/src/main/scala/neotype · high confidence

Test coverage

Added comprehensive test suite for neotype validation and semantics; Added test infrastructure for JSON library integration.

Dependencies

Upgrade to Scala 3.3.8 and update core dependencies

The project has upgraded its base Scala version from 3.2.2 to 3.3.8 and updated key library dependencies, including ZIO to 2.1.26, Tapir to 1.13.29, Circe to 0.14.16, and Doobie to 1.0.0-RC13. This change also enables semanticdb support and adds the \-Wunused:all\ compiler flag to improve code quality checks.

(dependencies) · 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 61.

Lenses

  • Code Health 81
  • Architecture 100
  • Maturity 53
  • Readiness 56
  • Security 75

Changes since last survey

  • 300 commits — 274 feature/other, 26 fixes

By area

  • (root) — 130 commits
  • (repo) — 90 commits
  • modules/comptime — 16 commits
  • project/plugins.sbt — 13 commits
  • modules/core — 10 commits
  • .github/workflows — 9 commits
  • modules/neotype-doobie — 6 commits
  • modules/neotype-caliban — 3 commits
  • modules/neotype-cats — 3 commits
  • modules/neotype-chimney — 3 commits
  • modules/neotype-scanamo — 3 commits
  • modules/neotype-tethys — 3 commits
  • examples/src — 2 commits
  • modules/neotype-pureconfig — 2 commits
  • project/build.properties — 2 commits
  • modules/neotype-circe — 1 commit
  • modules/neotype-ciris — 1 commit
  • modules/neotype-jsoniter — 1 commit
  • modules/neotype-upickle — 1 commit
  • modules/neotype-zio-json — 1 commit

Notable commits

  • fix: Fix CI: add write permissions for GitHub releases
  • fix: Fix CI: auto-create GitHub releases, remove snapshot publishing, update badge
  • fix: Fix New anonymous class definition will be duplicated at each inline site warning
  • fix: Fix link in README
  • fix: Fix three comptime match-evaluation bugs
  • fix: Fix try/catch fold parsing and clean test warnings
  • fix: Fix upickle test to extract error message from TraceException cause
  • fix: Fixed comparison in caliban spec, cleaned up imports
  • fix: Merge pull request #408 from felix-hedenstrom/fix-comparison-caliban-spec
  • fix: Merge pull request #522 from kitlangton/fix/scala-310-macro-regressions
  • fix: Simplify comptime error throwing; fix Try eager-eval bug
  • fix: ci: split CI to only test JVM (fix OOM)
  • fix: fix CI
  • fix: fix build
  • fix: fix build
  • fix: fix ci.yml
  • fix: fix interop-cats version - doh
  • fix: fix leftover merge marker in build
  • fix: fix pure config setup in build.sbt
  • fix: fix stacked neotype support in doobie
  • …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

kitlangton/neotype 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 d278c46814d581eb434b92f22036a5a5a5ace706 — 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.