davsclaus commented on code in PR #30590:
URL: https://github.com/apache/camel/pull/30590#discussion_r4657712430


##########
components/camel-protobuf-schema/src/main/java/org/apache/camel/dataformat/protobuf/schema/WireProtobufSchemaParser.java:
##########
@@ -123,7 +125,15 @@ private static Loader loader(ProtoFile file, Loader core) {
         return new Loader() {
             @Override
             public ProtoFile load(String path) {
-                return FILE_NAME.equals(path) ? file : core.load(path);
+                if (FILE_NAME.equals(path)) {
+                    return file;
+                }
+                try {
+                    return core.load(path);
+                } catch (RuntimeException e) {

Review Comment:
   Fixed in 6ad7cbd358cb: narrowed to `IllegalStateException`. Checked in Wire 
6.4.7 (`CoreLoader.load`): a path that is not one of its own files ends in `new 
IllegalStateException("unexpected load: " + path)`.
   
   _Claude Code on behalf of davsclaus_



##########
components/camel-protobuf-schema/src/main/java/org/apache/camel/dataformat/protobuf/schema/WireProtobufSchemaParser.java:
##########
@@ -56,6 +56,8 @@
 public class WireProtobufSchemaParser implements ProtobufSchemaParser {
 
     private static final String FILE_NAME = "camel-schema.proto";
+    private static final String WELL_KNOWN_TYPES = "any.proto, 
descriptor.proto, duration.proto, empty.proto,"
+                                                   + " struct.proto, 
timestamp.proto and wrappers.proto";

Review Comment:
   Wire 6.4.7 does not ship `google/protobuf/field_mask.proto`: the jar 
`wire-schema-jvm-6.4.7.jar` has only `any`, `descriptor`, `duration`, `empty`, 
`struct`, `timestamp` and `wrappers` (plus `wire/extensions.proto`), and 
`CoreLoaderKt.isWireRuntimeProto` lists the same files, so `CoreLoader.load` 
throws `IllegalStateException("unexpected load: 
google/protobuf/field_mask.proto")` before `wellKnownType()` is reached. So an 
import of `field_mask.proto` does fail, and the message is right not to list it.
   
   In 6ad7cbd358cb the unreachable `FieldMask` case is removed from 
`wellKnownType()`, the javadoc there says why, the docs (and the catalog copy) 
list `field_mask.proto` among the imports that are not supported, and the new 
test `importOfFieldMaskSaysOnlyTheWellKnownTypesCanBeImported` pins the 
message, so a Wire upgrade that ships the file shows up.
   
   _Claude Code on behalf of davsclaus_



##########
components/camel-protobuf-schema/src/main/docs/protobuf-schema.adoc:
##########
@@ -52,7 +52,7 @@ A YAML route that turns JSON text into a Protobuf message of 
the type `Order`, a
 
 == Supported schemas
 
-`proto2` and `proto3` files with nested messages, enums, maps, `oneof` and 
repeated fields. A schema may import these well-known types of 
`google/protobuf`, which are read in their JSON form (a `Timestamp` as RFC 3339 
text): `any.proto`, `descriptor.proto`, `duration.proto`, `empty.proto`, 
`struct.proto`, `timestamp.proto` and `wrappers.proto`. Other imports are not 
supported, including `api.proto`, `source_context.proto` and `type.proto`.
+`proto2` and `proto3` files with nested messages, enums, maps, `oneof` and 
repeated fields. A schema may import these well-known types of 
`google/protobuf`, which are read in their JSON form (a `Timestamp` as RFC 3339 
text): `any.proto`, `descriptor.proto`, `duration.proto`, `empty.proto`, 
`struct.proto`, `timestamp.proto` and `wrappers.proto`. Other imports are not 
supported, including `api.proto`, `source_context.proto` and `type.proto`: the 
schema is one file, and a schema that imports another file (such as `import 
"shop/common.proto";`) fails with a message that names the import. Put the 
types of the imported file in the schema itself.

Review Comment:
   Wire 6.4.7 does not ship `google/protobuf/field_mask.proto`: the jar 
`wire-schema-jvm-6.4.7.jar` has only `any`, `descriptor`, `duration`, `empty`, 
`struct`, `timestamp` and `wrappers` (plus `wire/extensions.proto`), and 
`CoreLoaderKt.isWireRuntimeProto` lists the same files, so `CoreLoader.load` 
throws `IllegalStateException("unexpected load: 
google/protobuf/field_mask.proto")` before `wellKnownType()` is reached. So an 
import of `field_mask.proto` does fail, and the message is right not to list it.
   
   In 6ad7cbd358cb the unreachable `FieldMask` case is removed from 
`wellKnownType()`, the javadoc there says why, the docs (and the catalog copy) 
list `field_mask.proto` among the imports that are not supported, and the new 
test `importOfFieldMaskSaysOnlyTheWellKnownTypesCanBeImported` pins the 
message, so a Wire upgrade that ships the file shows up.
   
   _Claude Code on behalf of davsclaus_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to