From c70768a728cf34a32e8666192158629874f8606c Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Wed, 19 Jan 2022 15:02:08 +0200 Subject: [PATCH] Reenable auto add path params --- sanic_ext/extensions/openapi/blueprint.py | 23 +++++++++++------------ setup.cfg | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/sanic_ext/extensions/openapi/blueprint.py b/sanic_ext/extensions/openapi/blueprint.py index 110526e..7a0997b 100644 --- a/sanic_ext/extensions/openapi/blueprint.py +++ b/sanic_ext/extensions/openapi/blueprint.py @@ -113,18 +113,17 @@ def build_spec(app, loop): ] = f"{method.lower()}~{route_name}" operation._default["summary"] = clean_route_name(route_name) - # TODO: solve for this - # for _parameter in route_parameters: - # if any( - # ( - # param.fields["name"] == _parameter.name - # for param in operation.parameters - # ) - # ): - # continue - # operation.parameter( - # _parameter.name, _parameter.cast, "path" - # ) + for _parameter in route_parameters: + if any( + ( + param.fields["name"] == _parameter.name + for param in operation.parameters + ) + ): + continue + operation.parameter( + _parameter.name, _parameter.cast, "path" + ) specification.operation(uri, method, operation) diff --git a/setup.cfg b/setup.cfg index 4f27f97..1d7d080 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = sanic-ext -version = 22.1.0 +version = 22.1.1 url = http://github.com/sanic-org/sanic-ext/ license = MIT author = Sanic Community