Skip to content

Commit 7c9915f

Browse files
committed
merged path and cookie gen resolver together
1 parent 7b0cb65 commit 7c9915f

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

ellar/common/params/args/resolver_generators.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,7 @@ def generate_resolvers(self, body_field_class: t.Type[FieldInfo]) -> None:
158158
] = True
159159

160160

161-
class PathArgsResolverGenerator(BulkArgsResolverGenerator):
162-
def validate(self, field_name: str, field: ModelField) -> None:
163-
if not is_scalar_field(field=field):
164-
raise ImproperConfiguration(
165-
"Path params must be of one of the supported types. Only primitive types"
166-
)
167-
161+
class PathArgsResolverGenerator(CookieResolverGenerator):
168162
def get_parameter_field(
169163
self,
170164
field_name: str,

tests/test_routing/test_path_with_schema.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,18 @@ def test_schema():
8282

8383

8484
def test_for_invalid_schema():
85-
with pytest.raises(ImproperConfiguration) as ex:
85+
with pytest.raises(ImproperConfiguration):
8686

8787
@get("/{filter}")
8888
def invalid_path_parameter(path: NonPrimitiveSchema = Path()):
8989
pass
9090

9191
build_route_handler(invalid_path_parameter)
9292

93-
assert (
94-
str(ex.value)
95-
== "Path params must be of one of the supported types. Only primitive types"
96-
)
97-
98-
with pytest.raises(ImproperConfiguration) as ex:
93+
with pytest.raises(ImproperConfiguration):
9994

10095
@get("/{int}/{float}")
10196
def invalid_path_parameter(path: ListOfPrimitiveSchema = Path()):
10297
pass
10398

10499
build_route_handler(invalid_path_parameter)
105-
106-
assert (
107-
str(ex.value)
108-
== "Path params must be of one of the supported types. Only primitive types"
109-
)

0 commit comments

Comments
 (0)