Skip to content

Add an init() that match the APIGatewayResponse #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

sebsto
Copy link
Contributor

@sebsto sebsto commented Aug 6, 2025

Add an init() to FunctionURLResponse to match the signature of APIGatewayv2Response

Motivation:

APIGAtewayV2Response and FunctionURLResponse share teh same structure, although we provided two different signatures for the initializers. This prevent writing common code to handle both responses.

Modifications:

  • add a new init(0 that has the same signature as the init from APIGatewayV2response
  • make the current init as deprecated, we will remove it in a future version bump

Result:

Two init() functions on FunctionURLResponse

@sebsto sebsto added the 🆕 semver/minor Adds new public API. label Aug 6, 2025
Copy link
Contributor

@natanrolnik natanrolnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! This will make #90 simpler 🙏🏻

@sebsto sebsto self-assigned this Aug 6, 2025
@sebsto sebsto merged commit 9edb1f8 into swift-server:main Aug 6, 2025
16 checks passed
natanrolnik added a commit to natanrolnik/swift-aws-lambda-events that referenced this pull request Aug 6, 2025
sebsto pushed a commit that referenced this pull request Aug 7, 2025
In a previous PR (#91), a new init with a different parameters order was
added, marking the previous one was deprecated. The problem is that the
compiler doesn't know which one to choose when omitting the final
parameters.

This PR fixes it by marking the deprecated init with
`@_disfavoredOverload`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants