From 25ed406872e9a67b6616cac3cdcaeb6b154666a7 Mon Sep 17 00:00:00 2001 From: Eelco Date: Sun, 18 Aug 2024 22:51:42 +0200 Subject: [PATCH] when version via HTTP Header then its a OAT\HeaderParameter() --- stubs/Api/CreateHandler.stub | 3 ++- stubs/Api/DeleteHandler.stub | 3 ++- stubs/Api/DetailHandler.stub | 11 ++--------- stubs/Api/PaginationHandler.stub | 11 ++--------- stubs/Api/UpdateHandler.stub | 3 ++- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/stubs/Api/CreateHandler.stub b/stubs/Api/CreateHandler.stub index 651a711..7e94c97 100644 --- a/stubs/Api/CreateHandler.stub +++ b/stubs/Api/CreateHandler.stub @@ -128,10 +128,11 @@ defined("BASE_URL") ?: define("BASE_URL", config('app.url')); schema: new OAT\Schema(type: "string") ) : null, - (API_VERSION_URL_HEADERS) ? new OAT\Parameter( + (API_VERSION_URL_HEADERS) ? new OAT\HeaderParameter( name: API_TRANSFORMER_HEADER, in: "header", required: true, + allowEmptyValue: true, description: "Set the correct API Version / Transformer you want to use.", schema: new OAT\Schema(type: "string") ) : null, diff --git a/stubs/Api/DeleteHandler.stub b/stubs/Api/DeleteHandler.stub index ce500c5..5a45458 100644 --- a/stubs/Api/DeleteHandler.stub +++ b/stubs/Api/DeleteHandler.stub @@ -133,10 +133,11 @@ defined("BASE_URL") ?: define("BASE_URL", config('app.url')); schema: new OAT\Schema(type: "string") ) : null, - (API_VERSION_URL_HEADERS) ? new OAT\Parameter( + (API_VERSION_URL_HEADERS) ? new OAT\HeaderParameter( name: API_TRANSFORMER_HEADER, in: "header", required: true, + allowEmptyValue: true, description: "Set the correct API Version / Transformer you want to use.", schema: new OAT\Schema(type: "string") ) : null, diff --git a/stubs/Api/DetailHandler.stub b/stubs/Api/DetailHandler.stub index f9f1673..c4322a1 100644 --- a/stubs/Api/DetailHandler.stub +++ b/stubs/Api/DetailHandler.stub @@ -128,14 +128,6 @@ defined("BASE_URL") ?: define("BASE_URL", config('app.url')); security: (!RESOURCE_PUBLIC_{{ capitalsResource }}_DETAIL) ? [["bearerAuth" => []]] : null, parameters: [ - new OAT\HeaderParameter( - name: RESOURCE_{{ capitalsResource }}_DETAIL_TRANSFORMER_HEADER_KEY, - description: "Select a custom Transformer if needed", - in: "header", - allowEmptyValue: true, - schema: new OAT\Schema(enum: RESOURCE_{{ capitalsResource }}_DETAIL_TRANSFORMERS), - ), - // (TENANT_AWARENESS_{{ capitalsResource }}) ? new OAT\Parameter(ref: "#/components/parameters/tenant") : null, (API_VERSION_URL_QUERY) ? new OAT\Parameter( @@ -146,10 +138,11 @@ defined("BASE_URL") ?: define("BASE_URL", config('app.url')); schema: new OAT\Schema(type: "string") ) : null, - (API_VERSION_URL_HEADERS) ? new OAT\Parameter( + (API_VERSION_URL_HEADERS) ? new OAT\HeaderParameter( name: API_TRANSFORMER_HEADER, in: "header", required: true, + allowEmptyValue: true, description: "Set the correct API Version / Transformer you want to use.", schema: new OAT\Schema(type: "string") ) : null, diff --git a/stubs/Api/PaginationHandler.stub b/stubs/Api/PaginationHandler.stub index 3b21d95..cda5553 100644 --- a/stubs/Api/PaginationHandler.stub +++ b/stubs/Api/PaginationHandler.stub @@ -129,14 +129,6 @@ defined("BASE_URL") ?: define("BASE_URL", config('app.url')); security: (!RESOURCE_PUBLIC_{{ capitalsResource }}_PAGINATION) ? [["bearerAuth" => []]] : null, parameters: [ - new OAT\HeaderParameter( - name: RESOURCE_{{ capitalsResource }}_PAGINATION_TRANSFORMER_HEADER_KEY, - description: "Select a custom Transformer if needed", - in: "header", - allowEmptyValue: true, - schema: new OAT\Schema(enum: RESOURCE_{{ capitalsResource }}_PAGINATION_TRANSFORMERS), - ), - // (TENANT_AWARENESS_{{ capitalsResource }}) ? new OAT\Parameter(ref: "#/components/parameters/tenant") : null, // (TENANT_AWARENESS_{{ capitalsResource }}) ? new OAT\Parameter(name: "tenant", description: 'ID of the tenant', schema: new OAT\Schema(type: 'integer|string'), required: true, in: "path") : null, @@ -148,10 +140,11 @@ defined("BASE_URL") ?: define("BASE_URL", config('app.url')); schema: new OAT\Schema(type: "string") ) : null, - (API_VERSION_URL_HEADERS) ? new OAT\Parameter( + (API_VERSION_URL_HEADERS) ? new OAT\HeaderParameter( name: API_TRANSFORMER_HEADER, in: "header", required: true, + allowEmptyValue: true, description: "Set the correct API Version / Transformer you want to use.", schema: new OAT\Schema(type: "string") ) : null, diff --git a/stubs/Api/UpdateHandler.stub b/stubs/Api/UpdateHandler.stub index 161239d..7884d3e 100644 --- a/stubs/Api/UpdateHandler.stub +++ b/stubs/Api/UpdateHandler.stub @@ -126,10 +126,11 @@ defined("BASE_URL") ?: define("BASE_URL", config('app.url')); schema: new OAT\Schema(type: "string") ) : null, - (API_VERSION_URL_HEADERS) ? new OAT\Parameter( + (API_VERSION_URL_HEADERS) ? new OAT\HeaderParameter( name: API_TRANSFORMER_HEADER, in: "header", required: true, + allowEmptyValue: true, description: "Set the correct API Version / Transformer you want to use.", schema: new OAT\Schema(type: "string") ) : null,