Skip to content

fix: relax AttributeDef.default_value and index_type_es_fields to Any#872

Open
cmgrote wants to merge 1 commit intomainfrom
BLDX-731
Open

fix: relax AttributeDef.default_value and index_type_es_fields to Any#872
cmgrote wants to merge 1 commit intomainfrom
BLDX-731

Conversation

@cmgrote
Copy link
Collaborator

@cmgrote cmgrote commented Mar 20, 2026

Summary

  • default_value: widened from str | None | UNSET to Any | None | UNSET
  • index_type_es_fields: widened from Dict[str, Dict[str, str]] | None | UNSET to Dict[str, Dict[str, Any]] | None | UNSET

Why

The live Atlas API returns non-string scalars for both fields:

  • default_value can be a native JSON boolean (false) or integer (0) where str was previously declared
  • index_type_es_fields inner values can be integers (e.g. {"ignore_above": 256}) where str was previously declared

msgspec with strict=False does not coerce int/boolstr, so any consumer decoding a live Atlas typedef response would hit a ValidationError. The only workaround was a deep JSON traversal before decoding — widening to Any eliminates that entirely.

Test plan

  • Existing typedef decode tests pass
  • Decoding a live Atlas typedef response with default_value: false / index_type_es_fields: {"ignore_above": 256} no longer raises ValidationError

Note

Low Risk
Low risk: only broadens type annotations for typedef decoding to accept non-string JSON scalars/values; behavior is otherwise unchanged aside from allowing more payloads to deserialize without errors.

Overview
Relaxes AttributeDef decoding in pyatlan_v9/model/typedef.py to match live Atlas API payloads.

default_value is widened from str to Any, and index_type_es_fields is widened so inner field values can be Any (not just str), preventing msgspec ValidationErrors when the API returns booleans/integers (for example false or {"ignore_above": 256}).

Written by Cursor Bugbot for commit 3346805. This will update automatically on new commits. Configure here.

Atlas API responses can return non-string scalars for these fields:
- default_value: native bool/int (e.g. false, 0) where str was expected
- index_type_es_fields values: int (e.g. {"ignore_above": 256}) where str was expected

msgspec strict=False does not coerce int/bool -> str, causing
ValidationError on live typedef responses. Widening to Any lets the
decoder accept whatever the API returns without pre-decode traversal.
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.

1 participant