Skip to content
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

Reference "name" field expects a package #3490

Closed
derickmr opened this issue Jul 6, 2023 · 1 comment
Closed

Reference "name" field expects a package #3490

derickmr opened this issue Jul 6, 2023 · 1 comment
Labels
area/storage Bug Something isn't working

Comments

@derickmr
Copy link
Contributor

derickmr commented Jul 6, 2023

When creating a new PROTOBUF artifact which contains references, the "name" field of the reference expects me to inform the package of my import instead of the actual field name. To make things clearer, find below an example.

curl -X POST http://localhost:8080/apis/registry/v2/groups/default/artifacts \ -H 'Content-Type: application/create.extended+json' \ -H "X-Registry-ArtifactId: my.test.Example" \ -H 'X-Registry-ArtifactType: PROTOBUF' \ --data-raw '{ "content": "syntax = \"proto3\";\n\npackage my.test;\n\nimport \"my/test/another_example.proto\";\n\nmessage Example {\n string item_id = 1;\n string item_name = 2;\n string item_type = 3;\n my.test.AnotherExample another_example = 4;\n}", "references": [ { "groupId": "default", "artifactId": "my.test.AnotherExample", "name": "my/test/another_example.proto", "version": 1 } ] }'

Note that the "name" field of the reference is my/test/another_example.proto, which is the package that field, instead of another_example, which is the actual field name.

I'd expect that the value of that field should match name of the field, instead of its package, as below:

... "references": [ { "groupId": "default", "artifactId": "my.test.AnotherExample", "name": "another_example", "version": 1 } ] ...

I did a little bit of debugging on this, and it seems that the dependencies are resolved by package in your FileDescriptorUtils: https://github.com/Apicurio/apicurio-registry/blob/main/utils/protobuf-schema-utilities/src/main/java/io/apicurio/registry/utils/protobuf/schema/FileDescriptorUtils.java#L1146 (note: I can be wrong about this being the root cause)

For reference, I am running Apicurio Registry on KSQL 2.4.2.Final version.

@derickmr derickmr added the Bug Something isn't working label Jul 6, 2023
@carlesarnal
Copy link
Member

carlesarnal commented Jul 13, 2023

Hi @derickmr,

The reference name must be something that allows the client application to fully resolve the referenced schema. That is why, in this case, you have the complete package + the field type and, e.g., for avro, you have the fully qualified schema name. Do you mind elaborating a bit more on the actual problem you're facing with this approach or why you think this is not the correct one?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/storage Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants