From 9baa3252718e101e823548f74032c94488334779 Mon Sep 17 00:00:00 2001 From: kow Date: Tue, 26 Jul 2022 14:58:06 +0900 Subject: [PATCH] support werkzeug 2.2.0 --- quart_openapi/swagger.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/quart_openapi/swagger.py b/quart_openapi/swagger.py index 1b52c87..889dde3 100644 --- a/quart_openapi/swagger.py +++ b/quart_openapi/swagger.py @@ -2,7 +2,7 @@ Provides the View class for generating the openapi.json file on the fly based on the Pint instance and decorators """ - +import re from collections import OrderedDict from http import HTTPStatus from itertools import chain @@ -11,7 +11,22 @@ from jsonschema import Draft4Validator from quart.routing import Map as RouteMap -from werkzeug.routing import _rule_re as ROUTE_VAR_RE +#from werkzeug.routing import _rule_re as ROUTE_VAR_RE +#from werkzeug.routing import _rule_re as ROUTE_VAR_RE +ROUTE_VAR_RE = re.compile( + r""" + (?P[^<]*) # static rule data + < + (?: + (?P[a-zA-Z_][a-zA-Z0-9_]*) # converter name + (?:\((?P.*?)\))? # converter arguments + \: # variable delimiter + )? + (?P[a-zA-Z_][a-zA-Z0-9_]*) # variable name + > + """, + re.VERBOSE, +) from .marshmallow import MARSHMALLOW, schema_to_json from .resource import Resource, get_expect_args