SpineEventEngine / validation

Apache License 2.0
3 stars 0 forks source link

`TypeSystem` does not know about module dependencies #82

Closed dmdashenkov closed 1 year ago

dmdashenkov commented 1 year ago

In order to generate Java code for validating messages, we build a TypeSystem of all the known to the analyzed application types... Or, at least, we want to do that.

In practice, we cannot include types from the module's dependencies into the TypeSystem. Since, when ProtoData fires compiler events, that form the basis of what a ProtoData plugin knows about the world, the events don't include information about the app's dependencies. That's why, when TypeSystem scoops the type info from ProtobufSourceFile views, some field types are not included there.

This means that when building validation code, developers cannot rely on the TypeSystem being comprehensive.

We should make the TypeSystem know about everything, not just the app's own types.

dmdashenkov commented 1 year ago

A temp fix for this issue is to add all the dependencies with Proto definitions to the Gradle project as protoData, as well as implementation/api. This is because we include the KnownTypes of the ProtoData runtime into the TypeSystem. By including the library with Proto definitions into ProtoData's runtime classpath, we allow TypeSystem to see it.

dmdashenkov commented 1 year ago

This has been fixed for some time now.