Skip to content

Commit

Permalink
The deprecate decorator was meant to be called without arguments
Browse files Browse the repository at this point in the history
This fixes an error as the decorator was initially coded.
  • Loading branch information
pgjones committed May 15, 2024
1 parent 92d40f9 commit c26bde0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/quart_schema/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,11 @@ def decorator(func: Callable) -> Callable:
return decorator


def deprecate() -> Callable:
def deprecate(func: Callable) -> Callable:
"""Mark endpoint as deprecated."""
setattr(func, QUART_SCHEMA_DEPRECATED, True)

def decorator(func: Callable) -> Callable:
setattr(func, QUART_SCHEMA_DEPRECATED, True)

return func

return decorator
return func


def security_scheme(schemes: Iterable[Dict[str, List[str]]]) -> Callable:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async def read_item() -> Tuple[Result, int, Headers]:
@validate_request(type_)
@validate_response(Result, 201, Headers)
@operation_id("make_item")
@deprecate()
@deprecate
async def create_item() -> Tuple[Result, int, Headers]:
return Result(name="bob"), 201, Headers(x_name="jeff")

Expand Down

0 comments on commit c26bde0

Please sign in to comment.