Skip to content

Non-erroring constructor for PolicyId  #551

@john-h-kastner-aws

Description

@john-h-kastner-aws

Category

User level API changes

Describe the feature you'd like to request

The PolicyId struct is currently only constructed Using PolicyId::from_str. This function returns a Result, but our documentation states that it "currently always returns Ok()." This encourages calling unwrap() on our Results, which in many other cases will result in a panic. I think we should commit to this API and make this from_str Infallible. Changing the error type would be breaking change, so we should also release a PolicyId::new(String) constructor in a minor version.

I don't recall ever considering a design where we might limit valid PolicyId strings, and adding a restriction at this point would be serious braking change. If we later decide that it should error, we can make the constructors error again as a breaking change in a major version, but making a valid PolicyId an error should already be treated as a breaking change. Being forced to change the function call would make it more obvious that a change occurred.

Describe alternatives you've considered

.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

Labels

3.1Features for 3.14.0feature-requestThis issue requets a substantial new feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions