Open
Description
From #994 (comment):
It would be very convenient to include a strongly typed type name in the schema for a generated message. For example:
syntax = "proto3";
package example;
message User {
string first_name = 1;
}
This definition generates a type User
and a const UserSchema
. The type's $typeName
property is strongly typed, but the schema's typeName
property is not:
const user: User = create(UserSchema);
user.$typeName; // "example.User"
UserSchema.typeName; // string
This means the schema's property cannot be used to construct an instance of the type, and it cannot be used to narrow down a message by using the property as a descriminator.
If it's possible without breaking changes, we should change the generated schema to support this.
Activity