From a82225204f9c893f7ab7b952449e36b3ab3bc857 Mon Sep 17 00:00:00 2001 From: Aaron Goin Date: Thu, 26 Jun 2025 11:40:37 -0700 Subject: [PATCH 1/2] Fixing bug where users couldn't put a description in their polyConfig field for glide functions --- polyapi/deployables.py | 1 + polyapi/parser.py | 8 +++++++- polyapi/typedefs.py | 1 + pyproject.toml | 2 +- test_bash.sh | 24 ++++++++++++++++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100755 test_bash.sh diff --git a/polyapi/deployables.py b/polyapi/deployables.py index d5c8bea..f8cafff 100644 --- a/polyapi/deployables.py +++ b/polyapi/deployables.py @@ -31,6 +31,7 @@ class ParsedDeployableConfig(TypedDict): context: str name: str type: DeployableTypes + description: Optional[str] disableAi: Optional[bool] config: Dict[str, Any] diff --git a/polyapi/parser.py b/polyapi/parser.py index 8ae3397..f474693 100644 --- a/polyapi/parser.py +++ b/polyapi/parser.py @@ -513,7 +513,13 @@ def generic_visit(self, node): deployable["context"] = context or deployable["config"].get("context", "") deployable["name"] = name or deployable["config"].get("name", "") deployable["disableAi"] = deployable["config"].get("disableAi", False) - deployable["description"] = deployable["types"].get("description", "") + deployable["description"] = deployable["config"].get("description", "") + if deployable["description"]: + if deployable["description"] != deployable["types"].get("description", ""): + deployable["types"]["description"] = deployable["description"] + deployable["dirty"] = True + else: + deployable["description"] = deployable["types"].get("description", "") if not deployable["name"]: print_red("ERROR") print("Function config is missing a name.") diff --git a/polyapi/typedefs.py b/polyapi/typedefs.py index 6d6ff18..b887103 100644 --- a/polyapi/typedefs.py +++ b/polyapi/typedefs.py @@ -78,6 +78,7 @@ class SchemaSpecDto(TypedDict): class PolyDeployable(TypedDict, total=False): context: str name: str + description: NotRequired[str] disable_ai: NotRequired[bool] # Optional field to disable AI diff --git a/pyproject.toml b/pyproject.toml index e27bb41..99ffea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.8.dev5" +version = "0.3.8.dev6" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [ diff --git a/test_bash.sh b/test_bash.sh new file mode 100755 index 0000000..c98a99c --- /dev/null +++ b/test_bash.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +MY_VAR="${FAAS_FUNCTIONS_BASE_PATH:-${FUNCTIONS_BASE_FOLDER:-/poly/funcs/serverfx}}" +echo "$MY_VAR" + +IFS="@" +for arg in "$@" +do + read -ra entry <<< "$arg" + read -ra package <<< "${entry[0]}" + if [ "${#entry[@]}" -eq '1' ]; + then + read -ra version <<< "latest" + else + read -ra version <<< "${entry[1]}" + fi + + echo "Package: $package" + echo "Version: $version" + echo "" + +done \ No newline at end of file From a012fe5f3284a0b4bd580ddcd1709aa56240aad6 Mon Sep 17 00:00:00 2001 From: Aaron Goin Date: Fri, 27 Jun 2025 08:43:37 -0700 Subject: [PATCH 2/2] removing test_bash which should not have been commited, and bumping the version --- pyproject.toml | 2 +- test_bash.sh | 24 ------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100755 test_bash.sh diff --git a/pyproject.toml b/pyproject.toml index 99ffea9..70f460a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.8.dev6" +version = "0.3.8.dev9" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [ diff --git a/test_bash.sh b/test_bash.sh deleted file mode 100755 index c98a99c..0000000 --- a/test_bash.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -e - -MY_VAR="${FAAS_FUNCTIONS_BASE_PATH:-${FUNCTIONS_BASE_FOLDER:-/poly/funcs/serverfx}}" -echo "$MY_VAR" - -IFS="@" -for arg in "$@" -do - read -ra entry <<< "$arg" - read -ra package <<< "${entry[0]}" - if [ "${#entry[@]}" -eq '1' ]; - then - read -ra version <<< "latest" - else - read -ra version <<< "${entry[1]}" - fi - - echo "Package: $package" - echo "Version: $version" - echo "" - -done \ No newline at end of file