Skip to content

Fix schema_dsl() IndexError when a field has no name before the colon - #1546

Open
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-schema-dsl-empty-field-name
Open

Fix schema_dsl() IndexError when a field has no name before the colon#1546
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-schema-dsl-empty-field-name

Conversation

@ikatyal2110

@ikatyal2110 ikatyal2110 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

When schema_dsl() receives a field with no name before the colon (e.g. ':description' or 'name, :description'), field_info.strip().split() returns an empty list and the subsequent field_parts[0] indexing raises IndexError. The fix adds a continue guard when field_parts is empty, silently skipping nameless fields; two new parametrize cases in test_utils.py cover both the all-nameless and mixed cases. Fixes #1545

When field_info is empty (e.g. ':some description'), field_info.strip().split()
returns [] and field_parts[0] raises IndexError. Skip the field with continue
when field_parts is empty, consistent with how blank field strings are already
filtered out during parsing.
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.

schema_dsl() raises IndexError when a field has no name before the colon

2 participants