Skip to content

fix: preserve false values in model fields - #811

Merged
kishore7snehil merged 1 commit into
masterfrom
fix/preserve-false-model-fields
Oct 8, 2026
Merged

kishore7snehil merged 1 commit into
masterfrom
fix/preserve-false-model-fields

Conversation

@kishore7snehil

Copy link
Copy Markdown
Contributor

Model#initialize resolved each field with ||, so an explicit false was treated as absent and never reached the model data. Every boolean set to false was dropped from to_h on requests and read back as nil on responses. For example, users.update(id:, blocked: false) sent an empty PATCH body and the tenant rejected it with a 400.

Changes

  • lib/auth0/internal/types/model.rb now decides presence with key? and nil?. The literal and default fallback applies only when the value is nil, and a field declared with default: false now falls back to false.
  • Both the API-name key and the field-name key are consumed, so the unused one no longer ends up in extra fields.
  • lib/auth0/internal/ is listed in .fernignore, so the change is applied here directly.

References

Testing

  • This change adds unit test coverage
  • This change adds integration test coverage
  • This change has been tested on the latest version of Ruby

Checklist

@dariochuquilla85

Copy link
Copy Markdown

Confirming from Snapdocs: we tested #811 int two Rails apps against our Auth0 dev tenant and it fixes this for us. flase values now survive in both requests and responses, and users.get , users.create and users.update work as expected.

@kishore7snehil
kishore7snehil merged commit c2ee5fa into master Oct 8, 2026
8 checks passed
@kishore7snehil
kishore7snehil deleted the fix/preserve-false-model-fields branch October 8, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model#initialize drops every false value — booleans are silently lost on requests and responses

3 participants