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

[swift] Fix conformance to ProtoMessage for heap allocated protos #3260

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ class SwiftGenerator private constructor(
.build()
fileMembers += FileMemberSpec.builder(structProtoCodableExtension).build()

val structMessageConformanceExtension = ExtensionSpec.builder(structType)
.messageConformanceExtension(type)
.build()
fileMembers += FileMemberSpec.builder(structMessageConformanceExtension).build()

val structCodableExtension = heapCodableExtension(structType, storageName, storageType)
fileMembers += FileMemberSpec.builder(structCodableExtension)
.addGuard("!$FLAG_REMOVE_CODABLE")
Expand Down
8 changes: 8 additions & 0 deletions wire-tests-swift/no-manifest/src/main/swift/AllTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,14 @@ extension AllTypes : Proto2Codable {

}

extension AllTypes : ProtoMessage {
Copy link
Collaborator Author

@dnkoutso dnkoutso Jan 23, 2025

Choose a reason for hiding this comment

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

This was incorrectly missing.


public static func protoMessageTypeURL() -> String {
return "type.googleapis.com/squareup.protos.kotlin.alltypes.AllTypes"
}

}

#if !WIRE_REMOVE_CODABLE
extension AllTypes : Codable {

Expand Down
Loading