Skip to content

Search for versions by content doesn't work for protobuf schema with references #6142

Open
@abhimoondra

Description

@abhimoondra

I am using the Rest API to search a schema version by content. If I search for a schema that doesn't have any references, the API returns results. But If I search for a schema where the original schema references another schema, in that case the schema registry doesn't return any results. Can you please help me with this. Is this something which is not supported with protobuf schema or am I doing something wrong?

Scenario 1 (Successfull):

Example schema without references:

// Source: 

syntax = "proto3";
package schema;

option java_multiple_files = true;

message TestEventSource {
  string messageContent = 1;

  string newMessageContent = 2;
}

Search Request:

curl --location 'http://localhost:8082/apis/registry/v3/search/versions?order=desc&orderby=globalId&groupId=default&artifactId=events.TestEventSource-value&canonical=true&artifactType=PROTOBUF' \
--header 'Content-Type: application/x-protobuf' \
--header 'Accept: application/json' \
--data '// Proto schema formatted by Wire, do not edit.
// Source: 

syntax = "proto3";
package schema;

option java_multiple_files = true;

message TestEventSource {
  string messageContent = 1;

  string newMessageContent = 2;
}
'

Response:

{
    "count": 1,
    "versions": [
        {
            "createdOn": "2025-04-17T10:04:32Z",
            "owner": "",
            "artifactType": "PROTOBUF",
            "state": "ENABLED",
            "globalId": 1,
            "version": "1",
            "contentId": 1,
            "artifactId": "events.TestEventSource-value",
            "modifiedBy": "",
            "modifiedOn": "2025-04-17T10:04:32Z"
        }
    ]
}

Scenario 2(Unsuccessful):

Schema with references:

// Proto schema formatted by Wire, do not edit.
// Source: 

syntax = "proto3";

package schema;

import "Meta.proto";

option java_multiple_files = true;

message TestEventSource {

  string messageContent = 1;

  string newMessageContent = 2;

  .schema.Meta meta = 3;
}

Reference

// Proto schema formatted by Wire, do not edit.
// Source: 

syntax = "proto3";

package schema;

option java_multiple_files = false;

message Meta {
  string name = 1;

  string timestamp = 2;

  string correlation_id = 3;

  string grouping = 4;

  string distribution_key = 5;
}

Search Request:

curl --location 'http://localhost:8082/apis/registry/v3/search/versions?order=desc&orderby=globalId&groupId=default&artifactId=events.TestEventSource-value&canonical=true&artifactType=PROTOBUF' \
--header 'Content-Type: application/x-protobuf' \
--header 'Accept: application/json' \
--data '// Proto schema formatted by Wire, do not edit.
// Source: 

syntax = "proto3";

package schema;

import "Meta.proto";

option java_package = "com.sixt.lib.event_schema";
option java_multiple_files = true;

message TestEventSource {

  string messageContent = 1;

  string newMessageContent = 2;

  .schema.Meta meta = 3;
}

Response:

{
    "count": 0,
    "versions": []
}

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions