Repository: sanic-org/sanic

Issue:
Incorrect typehints in route shorthand methods
**Describe the bug**
Route decorators in `sanic/mixins/routes.py` have incorrect typehints for the ` version` parameter.

**Expected**
https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L58

**Actual**
https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L194 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L259 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L296 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L332 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L367 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L411 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L456 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L501 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L538 https://github.com/sanic-org/sanic/blob/b731a6b48c8bb6148e46df79d39a635657c9c1aa/sanic/mixins/routes.py#L579



Discussion:
Hi ! I can take this one! 
All yours!

Resolving patch:
diff --git a/sanic/mixins/routes.py b/sanic/mixins/routes.py
--- a/sanic/mixins/routes.py
+++ b/sanic/mixins/routes.py
@@ -191,7 +191,7 @@ def add_route(
         methods: Iterable[str] = frozenset({"GET"}),
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         stream: bool = False,
         version_prefix: str = "/v",
@@ -256,7 +256,7 @@ def get(
         uri: str,
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         ignore_body: bool = True,
         version_prefix: str = "/v",
@@ -293,7 +293,7 @@ def post(
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
         stream: bool = False,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         version_prefix: str = "/v",
         error_format: Optional[str] = None,
@@ -329,7 +329,7 @@ def put(
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
         stream: bool = False,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         version_prefix: str = "/v",
         error_format: Optional[str] = None,
@@ -364,7 +364,7 @@ def head(
         uri: str,
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         ignore_body: bool = True,
         version_prefix: str = "/v",
@@ -408,7 +408,7 @@ def options(
         uri: str,
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         ignore_body: bool = True,
         version_prefix: str = "/v",
@@ -453,7 +453,7 @@ def patch(
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
         stream=False,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         version_prefix: str = "/v",
         error_format: Optional[str] = None,
@@ -498,7 +498,7 @@ def delete(
         uri: str,
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         ignore_body: bool = True,
         version_prefix: str = "/v",
@@ -535,7 +535,7 @@ def websocket(
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
         subprotocols: Optional[List[str]] = None,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         apply: bool = True,
         version_prefix: str = "/v",
@@ -576,7 +576,7 @@ def add_websocket_route(
         host: Optional[str] = None,
         strict_slashes: Optional[bool] = None,
         subprotocols=None,
-        version: Optional[int] = None,
+        version: Optional[Union[int, str, float]] = None,
         name: Optional[str] = None,
         version_prefix: str = "/v",
         error_format: Optional[str] = None,


Test patch: