Skip to content

practise grpc-swift-2 via youtube video #92

@diuming

Description

@diuming

practise grpc-swift-2 via your voide Getting started with gRPC Swift - George Barnett.

but I encountered an issue: (Generate Swift code)
hero/v1/HeroService.proto: is a file using edition 2024, which isn't supported by code generator protoc-gen-grpc-swift

Q1) Do I need to download the protoc executable file for this project?
Q2) Is something wrong with this project's settings?

HeroService.proto

edition = "2024";

package hero.v1;

option swift_prefix = "HeorV1_";

service HeroService {
    rpc Greeting(HeroRequest) returns (HeroResponse);
}

message HeroRequest {
    string name = 1;
}

message HeroResponse {
    string name = 1;
}
% swift package --allow-writing-to-package-directory generate-grpc-code-from-protos --output-path Sources/Service/Generated -- api
Building for debugging...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build of product 'protoc-gen-grpc-swift-2' complete! (4.43s)
Building for debugging...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build of product 'protoc-gen-swift' complete! (0.11s)
error: protoc failed to generate code

--------------------------------------------------------------------------------
Command run:

/usr/local/protoc-33.2/bin/protoc \
  --plugin=protoc-gen-grpc-swift=/project/swift-grpc-hero/.build/arm64-apple-macosx/debug/protoc-gen-grpc-swift-2-tool \
  --grpc-swift_out=/project/swift-grpc-hero/Sources/Service/Generated/ \
  --proto_path=api \
  --grpc-swift_opt=Visibility=Internal \
  --grpc-swift_opt=Server=true \
  --grpc-swift_opt=Client=true \
  --grpc-swift_opt=FileNaming=FullPath \
  --grpc-swift_opt=UseAccessLevelOnImports=false \
  hero/v1/HeroService.proto

--------------------------------------------------------------------------------
Error output (stderr):

hero/v1/HeroService.proto: is a file using edition 2024, which isn't supported by code generator protoc-gen-grpc-swift.  
Please ask the owner of this code generator to add support or switch back to a maximum of edition 2023.--grpc-swift_out: 
Image

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