From 8d80361d9a77e12c3c7144d387bf94e94dd89072 Mon Sep 17 00:00:00 2001 From: Jonas Born Date: Sun, 16 Jul 2023 14:20:27 +0200 Subject: [PATCH 1/2] #571 Added support for multiple filters --- .../OpenApi/OpenApiRecordsBuilder.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php b/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php index dec53cc0..261579b9 100644 --- a/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php +++ b/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php @@ -133,7 +133,7 @@ private function setPath(string $tableName) /*: void*/ if (in_array($operation, ['list', 'create'])) { $path = sprintf('/records/%s', $tableName); if ($operation == 'list') { - $parameters = ['filter', 'include', 'exclude', 'order', 'size', 'page', 'join']; + $parameters = ['filter', 'filter1', 'filter2', 'filter3', 'include', 'exclude', 'order', 'size', 'page', 'join']; } } else { $path = sprintf('/records/%s/{id}', $tableName); @@ -336,6 +336,27 @@ private function setComponentParameters() /*: void*/ $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); $this->openapi->set("components|parameters|filter|required", false); + $this->openapi->set("components|parameters|filter|name", "filter1"); + $this->openapi->set("components|parameters|filter|in", "query"); + $this->openapi->set("components|parameters|filter|schema|type", "array"); + $this->openapi->set("components|parameters|filter|schema|items|type", "string"); + $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); + $this->openapi->set("components|parameters|filter|required", false); + + $this->openapi->set("components|parameters|filter|name", "filter2"); + $this->openapi->set("components|parameters|filter|in", "query"); + $this->openapi->set("components|parameters|filter|schema|type", "array"); + $this->openapi->set("components|parameters|filter|schema|items|type", "string"); + $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); + $this->openapi->set("components|parameters|filter|required", false); + + $this->openapi->set("components|parameters|filter|name", "filter3"); + $this->openapi->set("components|parameters|filter|in", "query"); + $this->openapi->set("components|parameters|filter|schema|type", "array"); + $this->openapi->set("components|parameters|filter|schema|items|type", "string"); + $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); + $this->openapi->set("components|parameters|filter|required", false); + $this->openapi->set("components|parameters|include|name", "include"); $this->openapi->set("components|parameters|include|in", "query"); $this->openapi->set("components|parameters|include|schema|type", "string"); From c485dea300f525e02eeb017df322d204e0df7e44 Mon Sep 17 00:00:00 2001 From: Jonas Born Date: Sun, 16 Jul 2023 14:23:46 +0200 Subject: [PATCH 2/2] #571 Fixed Api definition --- .../OpenApi/OpenApiRecordsBuilder.php | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php b/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php index 261579b9..8203d971 100644 --- a/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php +++ b/src/Tqdev/PhpCrudApi/OpenApi/OpenApiRecordsBuilder.php @@ -336,26 +336,26 @@ private function setComponentParameters() /*: void*/ $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); $this->openapi->set("components|parameters|filter|required", false); - $this->openapi->set("components|parameters|filter|name", "filter1"); - $this->openapi->set("components|parameters|filter|in", "query"); - $this->openapi->set("components|parameters|filter|schema|type", "array"); - $this->openapi->set("components|parameters|filter|schema|items|type", "string"); - $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); - $this->openapi->set("components|parameters|filter|required", false); + $this->openapi->set("components|parameters|filter1|name", "filter1"); + $this->openapi->set("components|parameters|filter1|in", "query"); + $this->openapi->set("components|parameters|filter1|schema|type", "array"); + $this->openapi->set("components|parameters|filter1|schema|items|type", "string"); + $this->openapi->set("components|parameters|filter1|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); + $this->openapi->set("components|parameters|filter1|required", false); - $this->openapi->set("components|parameters|filter|name", "filter2"); - $this->openapi->set("components|parameters|filter|in", "query"); - $this->openapi->set("components|parameters|filter|schema|type", "array"); - $this->openapi->set("components|parameters|filter|schema|items|type", "string"); - $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); - $this->openapi->set("components|parameters|filter|required", false); + $this->openapi->set("components|parameters|filter2|name", "filter2"); + $this->openapi->set("components|parameters|filter2|in", "query"); + $this->openapi->set("components|parameters|filter2|schema|type", "array"); + $this->openapi->set("components|parameters|filter2|schema|items|type", "string"); + $this->openapi->set("components|parameters|filter2|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); + $this->openapi->set("components|parameters|filter2|required", false); - $this->openapi->set("components|parameters|filter|name", "filter3"); - $this->openapi->set("components|parameters|filter|in", "query"); - $this->openapi->set("components|parameters|filter|schema|type", "array"); - $this->openapi->set("components|parameters|filter|schema|items|type", "string"); - $this->openapi->set("components|parameters|filter|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); - $this->openapi->set("components|parameters|filter|required", false); + $this->openapi->set("components|parameters|filter3|name", "filter3"); + $this->openapi->set("components|parameters|filter3|in", "query"); + $this->openapi->set("components|parameters|filter3|schema|type", "array"); + $this->openapi->set("components|parameters|filter3|schema|items|type", "string"); + $this->openapi->set("components|parameters|filter3|description", "Filters to be applied. Each filter consists of a column, an operator and a value (comma separated). Example: id,eq,1"); + $this->openapi->set("components|parameters|filter3|required", false); $this->openapi->set("components|parameters|include|name", "include"); $this->openapi->set("components|parameters|include|in", "query");