Skip to content

API-breaking change in #1002 #1022

@Lukasa

Description

@Lukasa

The PR #1002 introduced an API breaking change. Specifically, the diff changed two messages signatures in Message+JSONAdditions, from

  public init(
    jsonString: String,
    options: JSONDecodingOptions = JSONDecodingOptions()
  ) throws

  public init(
    jsonUTF8Data: Data,
    options: JSONDecodingOptions = JSONDecodingOptions()
  )

to

  public init(
    jsonString: String,
    extensions: ExtensionMap? = nil,
    options: JSONDecodingOptions = JSONDecodingOptions()
  ) throws

  public init(
    jsonUTF8Data: Data,
    extensions: ExtensionMap? = nil,
    options: JSONDecodingOptions = JSONDecodingOptions()
  )

Adding new parameters to Swift methods, even when they are defaulted, is a SemVer major. This is because functions may be referred to by their complete label set: Message.init(jsonString:options:). With this change, the previously-valid fully-qualified method name no longer exists, and so compiles fail.

We need to update the code to restore the old methods, and to instead add new methods that take the extensions field. It's fine for the method body of the old methods to simply jump to the new ones, but they must continue to exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions