-
Notifications
You must be signed in to change notification settings - Fork 588
Open
Description
We've found that swift modules do not work when referencing enums.
Here's a repo that reproduces the issue.
TL;DR
proto/foo/v1/foo.proto
syntax = "proto3";
package foo.v1;
import "bar/v1/bar.proto";
// Foo represents a basic entity with a single Bar field
message Foo {
bar.v1.Bar bar = 1;
}
proto/bar/v1/bar.proto
syntax = "proto3";
package bar.v1;
// an example enum
enum Bar {
BAR_UNSPECIFIED = 0;
BAR_A = 1;
BAR_B = 2;
}
wire.yaml
Foo:
roots:
- foo.v1.*
dependencies:
- Bar
Bar:
roots:
- bar.v1.*
❯ rm -rf swift/modules && java -jar wire-compiler-5.3.3.jar \
--proto_path=proto/ \
--swift_out=swift/modules \
--experimental-module-manifest=wire.yaml
Writing .Bar declared in bar/v1/bar.proto to swift/modules/Bar (target=Swift)
Exception in thread "main" java.util.NoSuchElementException: Missing a zero value for Bar
at com.squareup.wire.swift.SwiftGenerator.validateProto3DefaultsExist(SwiftGenerator.kt:312)
at com.squareup.wire.swift.SwiftGenerator.generateMessage(SwiftGenerator.kt:335)
at com.squareup.wire.swift.SwiftGenerator.generateType(SwiftGenerator.kt:269)
at com.squareup.wire.swift.SwiftGenerator.generateTypeTo(SwiftGenerator.kt:256)
at com.squareup.wire.swift.SwiftSchemaHandler.handle(SwiftSchemaHandler.kt:47)
at com.squareup.wire.schema.SchemaHandler.handle(SchemaHandler.kt:152)
at com.squareup.wire.schema.SchemaHandler.handle(SchemaHandler.kt:43)
at com.squareup.wire.swift.SwiftSchemaHandler.handle(SwiftSchemaHandler.kt:34)
at com.squareup.wire.schema.WireRun.execute$wire_schema(WireRun.kt:321)
at com.squareup.wire.schema.WireRun.execute(WireRun.kt:240)
at com.squareup.wire.WireCompiler.compile(WireCompiler.kt:228)
at com.squareup.wire.WireCompiler$Companion.main(WireCompiler.kt:302)
at com.squareup.wire.WireCompiler.main(WireCompiler.kt)
The same proto files generate without experimental-module-manifest
.
berbs-fetch
Metadata
Metadata
Assignees
Labels
No labels