Skip to content

Commit

Permalink
when version via HTTP Header then its a OAT\HeaderParameter()
Browse files Browse the repository at this point in the history
  • Loading branch information
eelco2k committed Aug 18, 2024
1 parent fea4cf3 commit 25ed406
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
3 changes: 2 additions & 1 deletion stubs/Api/CreateHandler.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion stubs/Api/DeleteHandler.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 2 additions & 9 deletions stubs/Api/DetailHandler.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down
11 changes: 2 additions & 9 deletions stubs/Api/PaginationHandler.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion stubs/Api/UpdateHandler.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 25ed406

Please sign in to comment.