Skip to content

Commit 29953a4

Browse files
authored
Get all schemas via /schemas endpoint (#14)
1 parent 2ff73a4 commit 29953a4

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

kafka_schema_registry_admin/async_schema_registry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ async def delete_subject(
239239
permanent_url, async_client=self.get_async_client(async_client)
240240
)
241241

242+
async def get_all_schemas(self, async_client: httpx.AsyncClient = None) -> Response:
243+
url: str = "/schemas"
244+
req = self.client.get(url, async_client=self.get_async_client(async_client))
245+
return await req
246+
242247
async def get_schema_types(
243248
self, async_client: httpx.AsyncClient = None
244249
) -> Response:

kafka_schema_registry_admin/kafka_schema_registry_admin.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,16 @@ def delete_subject(
189189
permanent_url = f"{url}?permanent=true"
190190
return self.client.delete(permanent_url)
191191

192+
def get_all_schemas(self) -> Response:
193+
"""
194+
Method to get the list of subjects in the schema registry
195+
Undocumented??
196+
197+
:raises: requests.exceptions.HTTPError
198+
"""
199+
url_path: str = "/schemas"
200+
return self.client.get(url_path)
201+
192202
def get_schema_types(self) -> Response:
193203
"""
194204
Method to get the list of schema types and return the request object

tests/test_async_subjects_schemas.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ async def test_get_all_subjects(async_local_registry):
8888
assert isinstance(r, list) and r
8989
r = await async_local_registry.get_all_subjects(subject_prefix="test-subject4")
9090
assert "test-subject4" in r.json()
91+
r = await async_local_registry.get_all_schemas()
92+
assert r.json()
9193

9294

9395
@pytest.mark.asyncio(scope="session")

tests/test_subjects_schemas.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def test_get_all_subjects(local_registry):
8383
assert isinstance(r, list) and r
8484
r = local_registry.get_all_subjects(subject_prefix="test-subject4")
8585
assert "test-subject4" in r.json()
86+
r = local_registry.get_all_schemas()
87+
assert r.json()
8688

8789

8890
def test_get_all_schema_types(local_registry):

0 commit comments

Comments
 (0)