Skip to content
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

undo tiny public API breakage #1008

Merged
merged 1 commit into from
May 17, 2019
Merged

Conversation

weissi
Copy link
Member

@weissi weissi commented May 17, 2019

Motivation:

In #957 we accidentally broke the API just a little bit. We turned the
ByteToMessageHandler.init from

public init(_ decoder: Decoder)

into

public init(_ decoder: Decoder, maximumBufferSize: Int? = nil)

This looks totally benign and in almost all cases because of the default
argument, you wouldn't notice the API breakage. However, it's possible
to write code that works in NIO 2.0.0 but breaks in NIO 2.1.0. For
example

let g: (Dummy) -> ByteToMessageHandler<Dummy> = ByteToMessageHandler<Dummy>.init
let h: (Dummy) -> ByteToMessageHandler<Dummy> = ByteToMessageHandler<Dummy>.init(_:)

Modifications:

According to SemVer, this releases a patch that unbreaks the public API.

Result:

No API breakages (checked with swift-api-digester which also found the
breakage in the first place).

Motivation:

In apple#957 we accidentally broke the API just a little bit. We turned the
`ByteToMessageHandler.init` from

    public init(_ decoder: Decoder)

into

    public init(_ decoder: Decoder, maximumBufferSize: Int? = nil)

This looks totally benign and in almost all cases because of the default
argument, you wouldn't notice the API breakage. However, it's possible
to write code that works in NIO 2.0.0 but breaks in NIO 2.1.0. For
example

    let g: (Dummy) -> ByteToMessageHandler<Dummy> = ByteToMessageHandler<Dummy>.init
    let h: (Dummy) -> ByteToMessageHandler<Dummy> = ByteToMessageHandler<Dummy>.init(_:)

Modifications:

According to SemVer, this releases a patch that unbreaks the public API.

Result:

No API breakages (checked with `swift-api-digester` which also found the
breakage in the first place).
@weissi weissi requested a review from Lukasa May 17, 2019 16:08
@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label May 17, 2019
@Lukasa Lukasa added this to the 2.2.0 milestone May 17, 2019
@Lukasa Lukasa added 🔨 semver/patch No public API change. and removed 🆕 semver/minor Adds new public API. labels May 17, 2019
@weissi weissi merged commit 7623b5e into apple:master May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants