[GH-ISSUE #61] Refactor parameters structures to introduce Default for simpler initialization #143

Open
opened 2026-03-15 11:46:54 +03:00 by kerem · 1 comment
Owner

Originally created by @adpaco-aws on GitHub (Dec 5, 2025).
Original GitHub issue: https://github.com/awslabs/iam-policy-autopilot/issues/61

Enum variants like Parameter::Positional require adding fields like struct_fields: None on creation in many tests. We could simplify this by refactoring its fields into a struct and implementing Default on it.

Originally posted by @mschlaipfer in https://github.com/awslabs/iam-policy-autopilot/pull/50#discussion_r2592200658

Originally created by @adpaco-aws on GitHub (Dec 5, 2025). Original GitHub issue: https://github.com/awslabs/iam-policy-autopilot/issues/61 Enum variants like `Parameter::Positional` require adding fields like `struct_fields: None` on creation in many tests. We could simplify this by refactoring its fields into a struct and implementing `Default` on it. _Originally posted by @mschlaipfer in https://github.com/awslabs/iam-policy-autopilot/pull/50#discussion_r2592200658_
Author
Owner

@mschlaipfer commented on GitHub (Dec 8, 2025):

We should be deliberate with this, I think adding it to tests is okay, but we should not use that pattern everywhere. I tend to agree with https://corrode.dev/blog/defensive-programming/#code-smell-lazy-use-of-default

<!-- gh-comment-id:3628671630 --> @mschlaipfer commented on GitHub (Dec 8, 2025): We should be deliberate with this, I think adding it to tests is okay, but we should not use that pattern everywhere. I tend to agree with https://corrode.dev/blog/defensive-programming/#code-smell-lazy-use-of-default
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/iam-policy-autopilot#143
No description provided.