Skip to content

Commit

Permalink
import proto: fix types for enums inside a scope (#913)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriehSchneier committed Mar 19, 2024
1 parent fa5e27f commit 95833e8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Binary file modified internal/bundles/assets/import_proto_cli.arraiz
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/importer/proto/proto_to_sysl.arrai
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let typeNameWithPrefix = \typeName \prefix
# `scope` the current scope containing the messages with type definitions.
# `prefix` the prefix to use if the type is found in the current scope.
let referencedType = \t \file \appName \imports \scope \prefix
let usePrefix = cond { scope.messages?(t.name)?:{}: prefix };
let usePrefix = cond { scope.messages?(t.name)?:{} || scope.enums?(t.name)?:{}: prefix };
let name = typeNameWithPrefix(t.name, usePrefix);
# `referencedNs` finds the file that had the original type definition and returns the namespace of that file.
let referencedNs = \t \file \imports
Expand Down
4 changes: 2 additions & 2 deletions pkg/importer/proto/tests/google.sysl
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ google_protobuf:
@description =:
| A single field of a message type.
@source_path = "google/protobuf/type.proto"
cardinality <: Cardinality:
cardinality <: Field_Cardinality:
@description =:
| The field cardinality.
@json_tag = "cardinality"
Expand All @@ -265,7 +265,7 @@ google_protobuf:
| The field JSON name.
@json_tag = "jsonName"
@rpcId = "10"
kind <: Kind:
kind <: Field_Kind:
@description =:
| The field type.
@json_tag = "kind"
Expand Down

0 comments on commit 95833e8

Please sign in to comment.