diff --git a/backend/schema/array.go b/backend/schema/array.go index 77d29e6540..29463e8cac 100644 --- a/backend/schema/array.go +++ b/backend/schema/array.go @@ -34,7 +34,7 @@ func (a *Array) ToProto() proto.Message { func arrayToSchema(s *schemapb.Array) *Array { return &Array{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Element: TypeFromProto(s.Element), } } diff --git a/backend/schema/config.go b/backend/schema/config.go index 4800d46b6e..9f985812da 100644 --- a/backend/schema/config.go +++ b/backend/schema/config.go @@ -47,7 +47,7 @@ func (s *Config) schemaSymbol() {} func ConfigFromProto(p *schemapb.Config) *Config { return &Config{ - Pos: posFromProto(p.Pos), + Pos: PosFromProto(p.Pos), Comments: p.Comments, Name: p.Name, Type: TypeFromProto(p.Type), diff --git a/backend/schema/data.go b/backend/schema/data.go index 8f7a90310e..4b6c42437b 100644 --- a/backend/schema/data.go +++ b/backend/schema/data.go @@ -195,7 +195,7 @@ func (d *Data) ToProto() proto.Message { func DataFromProto(s *schemapb.Data) *Data { return &Data{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Name: s.Name, Export: s.Export, diff --git a/backend/schema/database.go b/backend/schema/database.go index d0eeb0c3c4..5080f42c9c 100644 --- a/backend/schema/database.go +++ b/backend/schema/database.go @@ -47,7 +47,7 @@ func (d *Database) IsExported() bool { return false } func DatabaseFromProto(s *schemapb.Database) *Database { return &Database{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Comments: s.Comments, Name: s.Name, Type: s.Type, diff --git a/backend/schema/enum.go b/backend/schema/enum.go index 700cc8ff68..2a3f2cd8f5 100644 --- a/backend/schema/enum.go +++ b/backend/schema/enum.go @@ -73,7 +73,7 @@ func (e *Enum) IsExported() bool { return e.Export } func EnumFromProto(s *schemapb.Enum) *Enum { e := &Enum{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Name: s.Name, Export: s.Export, Comments: s.Comments, @@ -145,7 +145,7 @@ func enumVariantListToSchema(e []*schemapb.EnumVariant) []*EnumVariant { func enumVariantToSchema(v *schemapb.EnumVariant) *EnumVariant { return &EnumVariant{ - Pos: posFromProto(v.Pos), + Pos: PosFromProto(v.Pos), Name: v.Name, Value: valueToSchema(v.Value), } diff --git a/backend/schema/errors.go b/backend/schema/errors.go index 55709cb727..a96e071409 100644 --- a/backend/schema/errors.go +++ b/backend/schema/errors.go @@ -36,7 +36,7 @@ func (e Error) Error() string { return fmt.Sprintf("%s-%d: %s", e.Pos, e.EndColu func errorFromProto(e *schemapb.Error) *Error { return &Error{ - Pos: posFromProto(e.Pos), + Pos: PosFromProto(e.Pos), Msg: e.Msg, EndColumn: int(e.EndColumn), Level: levelFromProto(e.Level), diff --git a/backend/schema/field.go b/backend/schema/field.go index bf4aaa6e6a..7868f1836f 100644 --- a/backend/schema/field.go +++ b/backend/schema/field.go @@ -70,7 +70,7 @@ func fieldListToSchema(s []*schemapb.Field) []*Field { func fieldToSchema(s *schemapb.Field) *Field { return &Field{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Name: s.Name, Comments: s.Comments, Type: TypeFromProto(s.Type), diff --git a/backend/schema/fsm.go b/backend/schema/fsm.go index f3c75233c3..a72e68d26b 100644 --- a/backend/schema/fsm.go +++ b/backend/schema/fsm.go @@ -24,7 +24,7 @@ type FSM struct { func FSMFromProto(pb *schemapb.FSM) *FSM { return &FSM{ - Pos: posFromProto(pb.Pos), + Pos: PosFromProto(pb.Pos), Name: pb.Name, Start: slices.Map(pb.Start, RefFromProto), Transitions: slices.Map(pb.Transitions, FSMTransitionFromProto), @@ -156,7 +156,7 @@ type FSMTransition struct { func FSMTransitionFromProto(pb *schemapb.FSMTransition) *FSMTransition { return &FSMTransition{ - Pos: posFromProto(pb.Pos), + Pos: PosFromProto(pb.Pos), From: RefFromProto(pb.From), To: RefFromProto(pb.To), } diff --git a/backend/schema/map.go b/backend/schema/map.go index 7d1f87289d..c08d16bd32 100644 --- a/backend/schema/map.go +++ b/backend/schema/map.go @@ -40,7 +40,7 @@ func (m *Map) ToProto() proto.Message { func mapToSchema(s *schemapb.Map) *Map { return &Map{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Key: TypeFromProto(s.Key), Value: TypeFromProto(s.Value), } diff --git a/backend/schema/metadataingress.go b/backend/schema/metadataingress.go index e0672da716..48aafb87e6 100644 --- a/backend/schema/metadataingress.go +++ b/backend/schema/metadataingress.go @@ -57,12 +57,12 @@ func ingressPathComponentListToSchema(s []*schemapb.IngressPathComponent) []Ingr switch n := n.Value.(type) { case *schemapb.IngressPathComponent_IngressPathLiteral: out = append(out, &IngressPathLiteral{ - Pos: posFromProto(n.IngressPathLiteral.Pos), + Pos: PosFromProto(n.IngressPathLiteral.Pos), Text: n.IngressPathLiteral.Text, }) case *schemapb.IngressPathComponent_IngressPathParameter: out = append(out, &IngressPathParameter{ - Pos: posFromProto(n.IngressPathParameter.Pos), + Pos: PosFromProto(n.IngressPathParameter.Pos), Name: n.IngressPathParameter.Name, }) } diff --git a/backend/schema/module.go b/backend/schema/module.go index 0e76bc01e9..ab0ed7bc2e 100644 --- a/backend/schema/module.go +++ b/backend/schema/module.go @@ -231,7 +231,7 @@ func ModuleFromProtoFile(filename string) (*Module, error) { // ModuleFromProto converts a protobuf Module to a Module and validates it. func ModuleFromProto(s *schemapb.Module) (*Module, error) { module := &Module{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Builtin: s.Builtin, Name: s.Name, Comments: s.Comments, diff --git a/backend/schema/protobuf_dec.go b/backend/schema/protobuf_dec.go index 3088ffbd0a..860b74d40c 100644 --- a/backend/schema/protobuf_dec.go +++ b/backend/schema/protobuf_dec.go @@ -6,7 +6,7 @@ import ( schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" ) -func posFromProto(pos *schemapb.Position) Position { +func PosFromProto(pos *schemapb.Position) Position { if pos == nil { return Position{} } @@ -63,27 +63,27 @@ func TypeFromProto(s *schemapb.Type) Type { case *schemapb.Type_Ref: return RefFromProto(s.Ref) case *schemapb.Type_Int: - return &Int{Pos: posFromProto(s.Int.Pos)} + return &Int{Pos: PosFromProto(s.Int.Pos)} case *schemapb.Type_Float: - return &Float{Pos: posFromProto(s.Float.Pos)} + return &Float{Pos: PosFromProto(s.Float.Pos)} case *schemapb.Type_String_: - return &String{Pos: posFromProto(s.String_.Pos)} + return &String{Pos: PosFromProto(s.String_.Pos)} case *schemapb.Type_Bytes: - return &Bytes{Pos: posFromProto(s.Bytes.Pos)} + return &Bytes{Pos: PosFromProto(s.Bytes.Pos)} case *schemapb.Type_Time: - return &Time{Pos: posFromProto(s.Time.Pos)} + return &Time{Pos: PosFromProto(s.Time.Pos)} case *schemapb.Type_Bool: - return &Bool{Pos: posFromProto(s.Bool.Pos)} + return &Bool{Pos: PosFromProto(s.Bool.Pos)} case *schemapb.Type_Array: return arrayToSchema(s.Array) case *schemapb.Type_Map: return mapToSchema(s.Map) case *schemapb.Type_Optional: - return &Optional{Pos: posFromProto(s.Optional.Pos), Type: TypeFromProto(s.Optional.Type)} + return &Optional{Pos: PosFromProto(s.Optional.Pos), Type: TypeFromProto(s.Optional.Type)} case *schemapb.Type_Unit: - return &Unit{Pos: posFromProto(s.Unit.Pos)} + return &Unit{Pos: PosFromProto(s.Unit.Pos)} case *schemapb.Type_Any: - return &Any{Pos: posFromProto(s.Any.Pos)} + return &Any{Pos: PosFromProto(s.Any.Pos)} } panic(fmt.Sprintf("unhandled type: %T", s.Value)) } @@ -92,17 +92,17 @@ func valueToSchema(v *schemapb.Value) Value { switch s := v.Value.(type) { case *schemapb.Value_IntValue: return &IntValue{ - Pos: posFromProto(s.IntValue.Pos), + Pos: PosFromProto(s.IntValue.Pos), Value: int(s.IntValue.Value), } case *schemapb.Value_StringValue: return &StringValue{ - Pos: posFromProto(s.StringValue.Pos), + Pos: PosFromProto(s.StringValue.Pos), Value: s.StringValue.GetValue(), } case *schemapb.Value_TypeValue: return &TypeValue{ - Pos: posFromProto(s.TypeValue.Pos), + Pos: PosFromProto(s.TypeValue.Pos), Value: TypeFromProto(s.TypeValue.Value), } } @@ -121,19 +121,19 @@ func metadataToSchema(s *schemapb.Metadata) Metadata { switch s := s.Value.(type) { case *schemapb.Metadata_Calls: return &MetadataCalls{ - Pos: posFromProto(s.Calls.Pos), + Pos: PosFromProto(s.Calls.Pos), Calls: refListToSchema(s.Calls.Calls), } case *schemapb.Metadata_Databases: return &MetadataDatabases{ - Pos: posFromProto(s.Databases.Pos), + Pos: PosFromProto(s.Databases.Pos), Calls: refListToSchema(s.Databases.Calls), } case *schemapb.Metadata_Ingress: return &MetadataIngress{ - Pos: posFromProto(s.Ingress.Pos), + Pos: PosFromProto(s.Ingress.Pos), Type: s.Ingress.Type, Method: s.Ingress.Method, Path: ingressPathComponentListToSchema(s.Ingress.Path), @@ -141,13 +141,13 @@ func metadataToSchema(s *schemapb.Metadata) Metadata { case *schemapb.Metadata_CronJob: return &MetadataCronJob{ - Pos: posFromProto(s.CronJob.Pos), + Pos: PosFromProto(s.CronJob.Pos), Cron: s.CronJob.Cron, } case *schemapb.Metadata_Alias: return &MetadataAlias{ - Pos: posFromProto(s.Alias.Pos), + Pos: PosFromProto(s.Alias.Pos), Kind: AliasKind(s.Alias.Kind), Alias: s.Alias.Alias, } @@ -163,7 +163,7 @@ func metadataToSchema(s *schemapb.Metadata) Metadata { catch = RefFromProto(s.Retry.Catch) } return &MetadataRetry{ - Pos: posFromProto(s.Retry.Pos), + Pos: PosFromProto(s.Retry.Pos), Count: count, MinBackoff: s.Retry.MinBackoff, MaxBackoff: s.Retry.MaxBackoff, @@ -172,20 +172,20 @@ func metadataToSchema(s *schemapb.Metadata) Metadata { case *schemapb.Metadata_Subscriber: return &MetadataSubscriber{ - Pos: posFromProto(s.Subscriber.Pos), + Pos: PosFromProto(s.Subscriber.Pos), Name: s.Subscriber.Name, } case *schemapb.Metadata_TypeMap: return &MetadataTypeMap{ - Pos: posFromProto(s.TypeMap.Pos), + Pos: PosFromProto(s.TypeMap.Pos), Runtime: s.TypeMap.Runtime, NativeName: s.TypeMap.NativeName, } case *schemapb.Metadata_Encoding: return &MetadataEncoding{ - Pos: posFromProto(s.Encoding.Pos), + Pos: PosFromProto(s.Encoding.Pos), Lenient: s.Encoding.Lenient, } diff --git a/backend/schema/ref.go b/backend/schema/ref.go index 6b848a9d6b..f54f09a689 100644 --- a/backend/schema/ref.go +++ b/backend/schema/ref.go @@ -113,7 +113,7 @@ func (r *Ref) String() string { func RefFromProto(s *schemapb.Ref) *Ref { return &Ref{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Name: s.Name, Module: s.Module, TypeParameters: slices.Map(s.TypeParameters, TypeFromProto), diff --git a/backend/schema/secret.go b/backend/schema/secret.go index 2b11e2d089..077ba332bf 100644 --- a/backend/schema/secret.go +++ b/backend/schema/secret.go @@ -47,7 +47,7 @@ func (s *Secret) schemaSymbol() {} func SecretFromProto(s *schemapb.Secret) *Secret { return &Secret{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Name: s.Name, Comments: s.Comments, Type: TypeFromProto(s.Type), diff --git a/backend/schema/subscription.go b/backend/schema/subscription.go index 8a3de39c8b..1aa8cf3010 100644 --- a/backend/schema/subscription.go +++ b/backend/schema/subscription.go @@ -49,7 +49,7 @@ func (s *Subscription) ToProto() proto.Message { func SubscriptionFromProto(s *schemapb.Subscription) *Subscription { return &Subscription{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Name: s.Name, Topic: RefFromProto(s.Topic), diff --git a/backend/schema/topic.go b/backend/schema/topic.go index e1fa150cb0..c05745d2da 100644 --- a/backend/schema/topic.go +++ b/backend/schema/topic.go @@ -57,7 +57,7 @@ func (t *Topic) ToProto() proto.Message { func TopicFromProto(t *schemapb.Topic) *Topic { return &Topic{ - Pos: posFromProto(t.Pos), + Pos: PosFromProto(t.Pos), Name: t.Name, Export: t.Export, diff --git a/backend/schema/typealias.go b/backend/schema/typealias.go index 38d95c102e..d9abea174f 100644 --- a/backend/schema/typealias.go +++ b/backend/schema/typealias.go @@ -62,7 +62,7 @@ func (t *TypeAlias) IsExported() bool { return t.Export } func TypeAliasFromProto(s *schemapb.TypeAlias) *TypeAlias { return &TypeAlias{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Name: s.Name, Export: s.Export, Comments: s.Comments, diff --git a/backend/schema/typeparameter.go b/backend/schema/typeparameter.go index 72bada81c0..d2c0f97ed2 100644 --- a/backend/schema/typeparameter.go +++ b/backend/schema/typeparameter.go @@ -27,7 +27,7 @@ func typeParametersToSchema(s []*schemapb.TypeParameter) []*TypeParameter { var out []*TypeParameter for _, n := range s { out = append(out, &TypeParameter{ - Pos: posFromProto(n.Pos), + Pos: PosFromProto(n.Pos), Name: n.Name, }) } diff --git a/backend/schema/verb.go b/backend/schema/verb.go index bfa3ebd462..48e3f567b9 100644 --- a/backend/schema/verb.go +++ b/backend/schema/verb.go @@ -126,7 +126,7 @@ func (v *Verb) ToProto() proto.Message { func VerbFromProto(s *schemapb.Verb) *Verb { return &Verb{ - Pos: posFromProto(s.Pos), + Pos: PosFromProto(s.Pos), Export: s.Export, Name: s.Name, Comments: s.Comments,