Skip to content

Commit

Permalink
schema_registry/handlers: Support get_schema_subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiman committed Aug 28, 2023
1 parent d7007f5 commit 12502e1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/v/pandaproxy/schema_registry/handlers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,28 @@ get_schemas_ids_id_versions(server::request_t rq, server::reply_t rp) {
co_return rp;
}

ss::future<ctx_server<service>::reply_t> get_schemas_ids_id_subjects(
ctx_server<service>::request_t rq, ctx_server<service>::reply_t rp) {
parse_accept_header(rq, rp);
auto id = parse::request_param<schema_id>(*rq.req, "id");
auto incl_del{
parse::query_param<std::optional<include_deleted>>(*rq.req, "deleted")
.value_or(include_deleted::no)};
rq.req.reset();

// List-type request: must ensure we see latest writes
co_await rq.service().writer().read_sync();

// Force early 40403 if the schema id isn't found
co_await rq.service().schema_store().get_schema_definition(id);

auto subjects = co_await rq.service().schema_store().get_schema_subjects(
id, incl_del);
auto json_rslt{json::rjson_serialize(subjects)};
rp.rep->write_body("json", json_rslt);
co_return rp;
}

ss::future<server::reply_t>
get_subjects(server::request_t rq, server::reply_t rp) {
parse_accept_header(rq, rp);
Expand Down
3 changes: 3 additions & 0 deletions src/v/pandaproxy/schema_registry/handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ ss::future<ctx_server<service>::reply_t> get_schemas_ids_id(
ss::future<ctx_server<service>::reply_t> get_schemas_ids_id_versions(
ctx_server<service>::request_t rq, ctx_server<service>::reply_t rp);

ss::future<ctx_server<service>::reply_t> get_schemas_ids_id_subjects(
ctx_server<service>::request_t rq, ctx_server<service>::reply_t rp);

ss::future<ctx_server<service>::reply_t> get_subjects(
ctx_server<service>::request_t rq, ctx_server<service>::reply_t rp);

Expand Down

0 comments on commit 12502e1

Please sign in to comment.