Skip to content

Commit e737c3c

Browse files
committed
fix(protowit): avoid implying valid oneofs are unsupported
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent 2cb0e64 commit e737c3c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

goworkspace/internal/protowit/errors.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const (
1212
unsupportedParameter unsupportedReason = iota + 1
1313
unsupportedPackage
1414
unsupportedEnum
15-
unsupportedOneofShape
15+
invalidOneofShape
1616
unsupportedMap
1717
unsupportedFieldKind
1818
unsupportedMessageReference
@@ -48,8 +48,8 @@ func (r unsupportedReason) String() string {
4848
return "protobuf package must contain a namespace and name"
4949
case unsupportedEnum:
5050
return "enums are not supported"
51-
case unsupportedOneofShape:
52-
return "oneof shape is not supported"
51+
case invalidOneofShape:
52+
return "oneof shape is invalid"
5353
case unsupportedMap:
5454
return "maps are not supported"
5555
case unsupportedFieldKind:

goworkspace/internal/protowit/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ func buildVariant(
477477
if oneof.Fields().Len() == 0 {
478478
return witVariant{}, &schemaError{
479479
element: oneof.FullName(),
480-
reason: unsupportedOneofShape,
480+
reason: invalidOneofShape,
481481
detail: "oneof must contain at least one member",
482482
}
483483
}
@@ -498,7 +498,7 @@ func buildVariant(
498498
if field.Cardinality() == protoreflect.Repeated {
499499
return witVariant{}, &schemaError{
500500
element: field.FullName(),
501-
reason: unsupportedOneofShape,
501+
reason: invalidOneofShape,
502502
detail: "oneof members cannot be repeated",
503503
}
504504
}

0 commit comments

Comments
 (0)