Skip to content

Commit

Permalink
Merge pull request #703 from Aiven-Open/dependabot/pip/requirements/n…
Browse files Browse the repository at this point in the history
…etworkx-3.1

build(deps): bump networkx from 2.8.8 to 3.1 in /requirements
  • Loading branch information
tvainika authored and eliax1996 committed Sep 15, 2023
2 parents 6d4b77f + 2eec5a1 commit 9740f53
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
7 changes: 6 additions & 1 deletion karapace/protobuf/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ def _process_nested_type(
one_of_parent_name = parent_name + "." + element_type.name
process_one_of(verifier, package_name, one_of_parent_name, one_of)
for field in element_type.fields:
verifier.add_used_type(parent_name, field.element_type)
# since we declare the subtype in the same level of the scope, it's legit
# use the same scoping when declare the dependent type.
if field.element_type in [defined_in_same_scope.name for defined_in_same_scope in element_type.nested_types]:
verifier.add_used_type(parent_name + "." + element_type.name, field.element_type)
else:
verifier.add_used_type(parent_name, field.element_type)
for nested_type in element_type.nested_types:
self._process_nested_type(verifier, package_name, parent_name + "." + element_type.name, nested_type)

Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ multidict==6.0.4
# -r requirements.txt
# aiohttp
# yarl
networkx==2.8.8
networkx==3.1
# via -r requirements.txt
packaging==23.1
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aiohttp<4
aiokafka<1
isodate<1
jsonschema<5
networkx<3
networkx<4
protobuf<4
python-dateutil<3
tenacity<9
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ multidict==6.0.4
# via
# aiohttp
# yarl
networkx==2.8.8
networkx==3.1
# via -r requirements.in
packaging==23.1
# via aiokafka
Expand Down
25 changes: 25 additions & 0 deletions tests/integration/test_schema_protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,24 @@ class ReferenceTestCase(BaseTestCase):
}
"""

SELF_REFERENCED_SCHEMA = """\
syntax = "proto3";
package fancy.company.in.party.v1;
message MyFirstMessage {
string my_fancy_string = 1;
}
message AnotherMessage {
message WowANestedMessage {
enum BamFancyEnum {
// Hei! This is a comment!
MY_AWESOME_FIELD = 0;
}
BamFancyEnum im_tricky_im_referring_to_the_previous_enum = 1;
}
}
"""


@pytest.mark.parametrize(
"testcase",
Expand Down Expand Up @@ -1000,6 +1018,13 @@ async def test_references(testcase: ReferenceTestCase, registry_async_client: Cl
assert fetch_schema_res.status_code == 200


async def test_self_reference_schema(registry_async_client: Client) -> None:
body = {"schemaType": SchemaType.PROTOBUF, "schema": SELF_REFERENCED_SCHEMA}
res = await registry_async_client.post("subjects/self_referenced_schema_test/versions", json=body)

assert res.status_code == 200


async def test_protobuf_error(registry_async_client: Client) -> None:
testdata = TestCaseSchema(
schema_type=SchemaType.PROTOBUF,
Expand Down

0 comments on commit 9740f53

Please sign in to comment.