From d3250a544ea7804e5703ad62a9beeb528135b069 Mon Sep 17 00:00:00 2001 From: "eric.neumann" Date: Thu, 14 Aug 2025 10:18:16 -0700 Subject: [PATCH] EN #4926 Disallow keyword only args --- polyapi/parser.py | 7 ++++++- pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/polyapi/parser.py b/polyapi/parser.py index 259c158..1485202 100644 --- a/polyapi/parser.py +++ b/polyapi/parser.py @@ -464,8 +464,13 @@ def visit_FunctionDef(self, node: ast.FunctionDef): if node.name == self._name: # Parse docstring which may contain param types and descriptions self._extract_docstring_from_function(node) + + if node.args.kwonlyargs: + print_red("ERROR") + print("Function signature has keyword-only arguments (after `*`). Please use only positional arguments.") + sys.exit(1) + function_args = [arg for arg in node.args.args] - function_args.extend(node.args.kwonlyargs) docstring_params = deployable["types"]["params"] parsed_params = [] # parse params from actual function and merge in any data from the docstring diff --git a/pyproject.toml b/pyproject.toml index 7ab87c6..063a6e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.10.dev2" +version = "0.3.10.dev3" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [