• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nshkrdotcom / sinter / 3a16437c363d845e72f861e5d67fbaa8ad0f7ddd
69%

Build:
DEFAULT BRANCH: main
Ran 29 Dec 2025 10:59AM UTC
Jobs 1
Files 11
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Dec 2025 10:58AM UTC coverage: 68.615% (+2.9%) from 65.751%
3a16437c363d845e72f861e5d67fbaa8ad0f7ddd

push

github

nshkrdotcom
Add discriminated unions, field aliases, and validation hooks

This commit introduces several advanced schema features to Sinter to support
more complex data structures and validation workflows.

The new discriminated_union type allows selecting a schema variant based on a
discriminator field value, commonly found in polymorphic JSON APIs. A literal
type is also added to support exact value matching.

Field aliases allow mapping canonical Elixir keys to different external string
keys. The validator now checks for both the alias and the canonical name, while
the transform module can optionally output data using these aliases.

New validation hooks provide more granular control:
- pre_validate: A schema-level function to transform raw input before standard
validation begins.
- field validators: Per-field functions that run after type checks for custom
logic and data transformation.

The JsonSchema module is updated to represent these new types and aliases in
generated documents using oneOf and discriminator mapping.

Key changes:
- Added :discriminated_union and :literal types to Sinter.Types
- Added :alias option to field definitions for serialization mapping
- Added :pre_validate schema configuration for early data normalization
- Added :validate option for custom per-field validation logic
- Updated Sinter.Transform to support schema-driven key aliasing
- Updated Sinter.JsonSchema to support oneOf and property name overrides

114 of 126 new or added lines in 5 files covered. (90.48%)

728 of 1061 relevant lines covered (68.61%)

4408.2 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
85.54
3.19% lib/sinter/validator.ex
5
86.92
-0.44% lib/sinter/schema.ex
6
77.92
3.35% lib/sinter/types.ex
Jobs
ID Job ID Ran Files Coverage
1 3a16437c363d845e72f861e5d67fbaa8ad0f7ddd.1 29 Dec 2025 10:59AM UTC 11
68.61
GitHub Action Run
Source Files on build 3a16437c363d845e72f861e5d67fbaa8ad0f7ddd
  • Tree
  • List 11
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 3a16437c on github
  • Prev Build on main (#FC522C68...)
  • Next Build on main (#662AD5D2...)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc