Repository navigation
Fix parameter casting, schema declarations, and validation before 0.4.1 - #9
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partial embed updates could lose pending fields, mix records, resurrect stale parameters, or silently ignore supplied structs. Schema declarations could also use the wrong alias or attribute values, including dropping field redaction. This fixes those behaviors and aligns nested input handling with the public API before 0.4.1.
Parameter casting and embed updates
on_replace: :update, including direct changeset updates that omit or change the primary key. Ordinary lists without primary keys retain omitted fields by position while respecting Ecto's replacement policy.on_type_not_found, even when a single embed already has a value; only omitted tags can reuse that variant.Nil keys, generation, and nested validation
new/1andchange/2perform generation.Ecto.Typeand parameterized IDs. Use the type's generator when available, otherwise cast a UUID through a binary-ID-backed type. Shared generators run once, so initial timestamps agree.:insertaction, trusted structs still skip validation, and plain Ecto children keep theirchangeset/2callback.Schema declarations and validation
primary_key: false.defstruct, preserve validation order, support guards following options, and capture guard attributes at their declaration.Documentation and regression coverage
Update README, usage/schema/JSON/polymorphic guides, generated API documentation, and the 0.4.1 changelog. Clarify supported declarations and the three previously inconsistent contracts: explicit nil polymorphic IDs, positional no-key list updates, and nested action guards. Correct standalone schema examples, JSON return values, timestamp precision, and the custom constructor example's undeclared UUID dependency.
All four reproduction batches were committed before their fixes: 5, 17, 14, and 25 cases. The latest 25 P1/P2 reproductions failed at tests-only commit
e759695; additional coverage exercises source context, quote/unquote, malformed tag policies, nested actions, ID generation, and JSON round trips. Tests are organized by behavior inparameter_casting_test.exsandschema_declarations_test.exs.Validation
mix test --warnings-as-errors: 174 tests passed on local Elixir 1.20.5.mix format --check-formattedandgit diff --check: passed.mix docs --warnings-as-errors: passed.mix hex.build: passed.95d61e0(Elixir 1.17.3/OTP 27, 1.18.4/27, 1.19.5/28, and 1.20.0/28).Version remains 0.4.1; no release tag or Hex publication is included. The audit's P3
:idtypespec finding is outside this P1/P2 fix.