Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion common/signature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ std::string StripUnescapedWhitespace(std::string_view str) {
}

absl::optional<TypeSpec> ParseBuiltinOrWrapper(std::string_view name_str) {
if (name_str == "null") return TypeSpec(NullTypeSpec());
if (name_str == "null" || name_str == "null_type" ||
name_str == "google.protobuf.NullValue")
return TypeSpec(NullTypeSpec());
if (name_str == "bool") return TypeSpec(PrimitiveType::kBool);
if (name_str == "int") return TypeSpec(PrimitiveType::kInt64);
if (name_str == "uint") return TypeSpec(PrimitiveType::kUint64);
Expand Down
9 changes: 9 additions & 0 deletions common/signature_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,15 @@ TEST(ParseSignatureTest, ProtoParsing) {
*GetTestingDescriptorPool()));
EXPECT_TRUE(gp_any.IsAny());

ASSERT_OK_AND_ASSIGN(auto null_alias, ParseType("null_type", GetTestArena(),
*GetTestingDescriptorPool()));
EXPECT_TRUE(null_alias.IsNull());

ASSERT_OK_AND_ASSIGN(auto gp_null_value,
ParseType("google.protobuf.NullValue", GetTestArena(),
*GetTestingDescriptorPool()));
EXPECT_TRUE(gp_null_value.IsNull());

ASSERT_OK_AND_ASSIGN(auto gp_timestamp,
ParseType("google.protobuf.Timestamp", GetTestArena(),
*GetTestingDescriptorPool()));
Expand Down
2 changes: 2 additions & 0 deletions env/env_yaml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ ConstantKindCase GetConstantKindCase(absl::string_view type_name) {
static const auto kTypeNameToConstantKindCase =
absl::NoDestructor<absl::flat_hash_map<std::string, ConstantKindCase>>({
{"null", ConstantKindCase::kNull},
{"null_type", ConstantKindCase::kNull},
{"google.protobuf.NullValue", ConstantKindCase::kNull},
{"bool", ConstantKindCase::kBool},
{"int", ConstantKindCase::kInt},
{"uint", ConstantKindCase::kUint},
Expand Down
2 changes: 2 additions & 0 deletions env/type_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ std::optional<TypeKind> TypeNameToTypeKind(absl::string_view type_name) {
absl::flat_hash_map<absl::string_view, TypeKind>>
kTypeNameToTypeKind({
{"null", TypeKind::kNull},
{NullType::kName, TypeKind::kNull},
{"google.protobuf.NullValue", TypeKind::kNull},
{"bool", TypeKind::kBool},
{"int", TypeKind::kInt},
{"uint", TypeKind::kUint},
Expand Down
12 changes: 12 additions & 0 deletions env/type_info_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ TEST_P(TypeInfoTest, TypeInfo) {

std::vector<TestCase> GetTestCases() {
return {
TestCase{
.type_info = {.name = "null"},
.expected_type_pb = "null: NULL_VALUE",
},
TestCase{
.type_info = {.name = "null_type"},
.expected_type_pb = "null: NULL_VALUE",
},
TestCase{
.type_info = {.name = "google.protobuf.NullValue"},
.expected_type_pb = "null: NULL_VALUE",
},
TestCase{
.type_info = {.name = "int"},
.expected_type_pb = "primitive: INT64",
Expand Down
Loading