Skip to content

Commit

Permalink
refactor: fix ENUM_ZERO_VALUE_SUFFIX (#3580)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas authored Nov 29, 2024
1 parent 5dbc850 commit 1e39343
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 54 deletions.
1 change: 0 additions & 1 deletion backend/protos/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ lint:
except:
- RPC_REQUEST_RESPONSE_UNIQUE
# Remove these exceptions once they're fixed
- ENUM_ZERO_VALUE_SUFFIX
- PACKAGE_VERSION_SUFFIX
57 changes: 33 additions & 24 deletions backend/protos/xyz/block/ftl/v1/schema/schema.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions backend/protos/xyz/block/ftl/v1/schema/schema.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ message AWSIAMAuthDatabaseConnector {
}

enum AliasKind {
ALIAS_KIND_JSON = 0;
ALIAS_KIND_UNSPECIFIED = 0;
ALIAS_KIND_JSON = 1;
}

message Any {
Expand Down Expand Up @@ -121,8 +122,9 @@ message Float {
}

enum FromOffset {
FROM_OFFSET_BEGINNING = 0;
FROM_OFFSET_LATEST = 1;
FROM_OFFSET_UNSPECIFIED = 0;
FROM_OFFSET_BEGINNING = 1;
FROM_OFFSET_LATEST = 2;
}

message IngressPathComponent {
Expand Down
34 changes: 23 additions & 11 deletions frontend/console/src/protos/xyz/block/ftl/v1/schema/schema_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions internal/schema/aliaskind_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/schema/metadataalias.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
type AliasKind int

const (
AliasKindJson AliasKind = iota //nolint
AliasKindUnspecified AliasKind = iota
AliasKindJson //nolint
)

//protobuf:5
Expand Down
5 changes: 3 additions & 2 deletions internal/schema/metadatasubscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
type FromOffset int

const (
FromOffsetBeginning FromOffset = iota
FromOffsetUnspecified FromOffset = iota
FromOffsetBeginning
FromOffsetLatest
)

Expand All @@ -35,7 +36,7 @@ func (o FromOffset) String() string {
case FromOffsetLatest:
return "latest"
default:
panic("unexpected value")
panic(fmt.Sprintf("unexpected value %d", o))
}
}

Expand Down
1 change: 1 addition & 0 deletions internal/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ func TestParsing(t *testing.T) {
Module: "test",
Name: "topicB",
},
FromOffset: FromOffsetBeginning,
DeadLetter: true,
},
&MetadataRetry{
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1e39343

Please sign in to comment.