Skip to content

Make payload member length non-nullable - #127

Merged
bruno-f-cruz merged 1 commit into
harp-tech:mainfrom
glopesdev:non-nullable-member-length
Aug 24, 2026
Merged

Make payload member length non-nullable#127
bruno-f-cruz merged 1 commit into
harp-tech:mainfrom
glopesdev:non-nullable-member-length

Conversation

@glopesdev

Copy link
Copy Markdown
Contributor

The payload member length is now declared as an int, matching the register length. A member declaring no length continues to mean a single element.

C#, Python and firmware interfaces generate every expected output file exactly as before. The round-trip serializer test also passes unchanged, since a zero int is omitted from written YAML under OmitDefaults exactly as a null is under OmitNull.

PayloadMemberInfo.Length changes the type of a public field, so anything reading it directly is affected. RegisterInfo.Length is unaffected, having always been an int.

Notes for review

Offset stays nullable. member.Offset.HasValue decides whether a member of an array register is indexed, and an offset of zero is both legal and common, so absence and zero must stay distinct there.

Closes #125

Declare the payload member length as an int, matching the register,
and read it directly wherever it was previously converted from null
to zero. A missing length still means a single element, and generated
output is unchanged for every target.

The interop value builder now sizes an explicit length of zero as one
element rather than zero, which no device schema declares.

Closes harp-tech#125
@glopesdev
glopesdev requested a review from bruno-f-cruz August 24, 2026 22:23
@glopesdev glopesdev added the feature New planned feature label Aug 24, 2026
@bruno-f-cruz
bruno-f-cruz merged commit d472083 into harp-tech:main Aug 24, 2026
9 checks passed
glopesdev added a commit that referenced this pull request Aug 24, 2026
Declare the payload member length as an int, matching the register,
and read it directly wherever it was previously converted from null
to zero. A missing length still means a single element, and generated
output is unchanged for every target.

The interop value builder now sizes an explicit length of zero as one
element rather than zero, which no device schema declares.

Closes #125
@glopesdev
glopesdev deleted the non-nullable-member-length branch August 24, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New planned feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the payload member length non-nullable to match the register

2 participants