@@ -1526,6 +1526,41 @@ async def test_schema_same_subject(registry_async_client: Client, trail: str) ->
15261526 assert json == {"id" : schema_id , "subject" : subject , "schema" : ujson .loads (schema_str ), "version" : 1 }
15271527
15281528
1529+ async def test_schema_same_subject_unnamed (registry_async_client : Client ) -> None :
1530+ """
1531+ The same schema JSON should be returned when checking the same schema str against the same subject
1532+ """
1533+ subject_name_factory = create_subject_name_factory ("test_schema_same_subject_unnamed" )
1534+ schema_name = create_schema_name_factory ("test_schema_same_subject_unnamed" )()
1535+
1536+ schema_str = ujson .dumps (
1537+ {
1538+ "type" : "int" ,
1539+ "name" : schema_name ,
1540+ }
1541+ )
1542+ subject = subject_name_factory ()
1543+ res = await registry_async_client .post (
1544+ f"subjects/{ subject } /versions" ,
1545+ json = {"schema" : schema_str },
1546+ )
1547+ assert res .status_code == 200
1548+ schema_id = res .json ()["id" ]
1549+
1550+ unnamed_schema_str = ujson .dumps ({"type" : "int" })
1551+
1552+ res = await registry_async_client .post (
1553+ f"subjects/{ subject } " ,
1554+ json = {"schema" : unnamed_schema_str },
1555+ )
1556+ assert res .status_code == 200
1557+
1558+ # Switch the str schema to a dict for comparison
1559+ json = res .json ()
1560+ json ["schema" ] = ujson .loads (json ["schema" ])
1561+ assert json == {"id" : schema_id , "subject" : subject , "schema" : ujson .loads (schema_str ), "version" : 1 }
1562+
1563+
15291564@pytest .mark .parametrize ("trail" , ["" , "/" ])
15301565async def test_schema_version_number_existing_schema (registry_async_client : Client , trail : str ) -> None :
15311566 """
0 commit comments