-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seeking for alternate validation solution, without the need of extension options within descriptor #42
Comments
Thank you for the detailed issue report. Option 1 (no extensions/options)I don't think there is anything to be done here if another tool removes extensions. Working with no extensions/options is a major architectural change for protovalidate, so if you wish to pursue further this is probably better tracked at https://github.com/bufbuild/protovalidate (since it isn't a problem specific to the Java implementation). I do recall that at some point Confluent didn't support extensions but I believe newer versions do - see confluentinc/schema-registry#2357. Which version of the Confluent libraries are you on? Also note, Buf has a Confluent Schema Registry integration available for enterprise customers which preserves all features of .proto files including extensions/options: https://buf.build/docs/data-pipeline/confluent/overview. Option 2I believe #48 should resolve issues seen with |
Hi @pkwarren We think the issue is with how confluent schema-registry code which we use to retrieve the schema through REST API, but not with the schema registry itself. Could you please explain more on how switching to the Buf hosted schema registry will help in this case. |
The main issue with losing extensions/options on proto messages is with how protobuf schemas tend to make it into the CSR. With the default producer setting of auto registering schemas, the client code will convert generated protobuf code (via reflection) to a .proto schema (which can be lossy), which is then registered with the CSR which parses the schema into its own representation before persisting it (also can be lossy). What is ultimately served up by the REST API is the final form of the schema after it has been processed through multiple systems. For example, a producer using an older version of Confluent protobuf support will lose extensions/options when registering schemas or if an instance of the CSR is on an older version, it too could drop parts of the schema which aren't supported. The BSR solution doesn't perform a potentially lossy conversion of a protobuf schema using reflection - it stores the .proto files directly in the BSR with no transformation (the files on disk are identical to the ones stored in the BSR with All that being said feel free to hop on our public slack if you have further questions. I'm going to go ahead and close this issue as I believe the primary reported issue regarding validation with DynamicMessage is now resolved in the latest version. |
Description
Validator skips/ignores as unable to find descriptor with FieldOptions extension(s). Descriptor was generated using confluent java api OR protoc command with --descriptor_set_out param
With current client architecture, .proto schema files get stored in the Confluent Schema registry. And when reading & parsing the .proto schemas from schema registry, below two options are tried and the generated descriptors does not serve the purpose.
Option1: service uses confluent java library, which is resulting in a descriptor with NO FieldOptions extension(s).
Option2: Generated descriptor file using protoc command with --descriptor_set_out=<file_name> option parameter. With this option, custom FieldOptions are parsed as unknownFields and options are fetched with extension numbers, instead of FieldOption extension(s).
Expected data in the descriptor
Validator psuedo code
Test schema that was used:
Lastly one option worked with generated classes/model, but it cannot be used with the current client architecture. So, looking for any other alternate option
Whereas in our case generated model is NOT an option so far. Would there be any other solution that someone can suggest instead of using descriptor with or without generated model ? Thank you
The text was updated successfully, but these errors were encountered: