hex typed_ecto_schema 0.5.0
on Hex

3 hours ago

Added

  • Field documentation: fields accept a :doc option; the <!-- typed_ecto_schema: fields --> marker in your @moduledoc is replaced at compile time with a list of every field, its typespec and its doc. Independently of the marker, the generated t/0 gets a @typedoc with the same fields list when the module doesn't define one (#68, closes #41)
  • Experimental: opt-in named types for Ecto.Enum fields via the additional_types: true schema option or the global config :typed_ecto_schema, additional_types: true — e.g. @type role() :: :admin | :user usable as Person.role() (#63, closes #39)
  • Experimental: support for polymorphic_embed's polymorphic_embeds_one/2 and polymorphic_embeds_many/2 behind a compile-time flag (config :typed_ecto_schema, polymorphic_embed: true), inferring the union of the :types modules without adding any dependency (#64, closes #40)
  • When both experimental features are enabled, polymorphic embed fields also get named types (element union for _many)

Fixed

  • Schema function options are no longer evaluated in the module body, so module aliases in pass-through options (e.g. many_to_many(..., join_through: Book)) no longer create compile-time dependencies — matching plain Ecto.Schema; guarded by a compiler-tracer regression test (#67, closes #38 and #26)

Docs

Full changelog: https://github.com/bamorim/typed_ecto_schema/blob/0.5.0/CHANGELOG.md

Don't miss a new typed_ecto_schema release

NewReleases is sending notifications on new releases.