square / square/wire

Generate methods for Swift, not just structs

Open
#2,502 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
4.4k
Forks
627
Avg merge
3d 15m
Merged PRs (30d)
20

Description

Consider the following "hello world" proto:
https://github.com/grpc/grpc/blob/master/examples/protos/helloworld.proto

Compare the following commands:

  1. java -jar wire-compiler-4.7.2-jar-with-dependencies.jar --proto_path=. --kotlin_out=. helloworld.proto
  2. java -jar wire-compiler-4.7.2-jar-with-dependencies.jar --proto_path=. --swift_out=. helloworld.proto

Running the Kotlin version (1 above) generates the following four files:

HelloReply.kt
HelloRequest.kt
GreeterClient.kt
GrpcGreeterClient.kt

Running the Swift version (2 above), however, generates only:

HelloReply.swift
HelloRequest.swift

How to generate the two missing files for Swift also? (For example, a Swift protocol and a class or struct that conforms to that protocol, which contains Swift methods?) Otherwise all we have is models (structs). If it's not currently possible to generate Swift methods, what is the use case for the Swift Wire version in its current form?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/protos/helloworld.proto and compare the Wire compiler's --kotlin_out and --swift_out behavior. Trace the Swift generator entry point to determine whether service methods are supported; done means Swift output includes equivalents of GreeterClient.kt and GrpcGreeterClient.kt, or the supported limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin, swift
Domain
api, backend-api-design, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.