docs-util: add publishable api key header parameter to store routes OAS (#10747)

* docs-util: add publishable api key header parameter to store routes OAS

* fix oas
This commit is contained in:
Shahed Nasser
2024-12-26 16:27:55 +02:00
committed by GitHub
parent b9e7090842
commit 91ebf6d61c
92 changed files with 1268 additions and 76 deletions

View File

@@ -21,6 +21,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -15,6 +15,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -8,6 +8,14 @@
* url: https://docs.medusajs.com/v2/resources/storefront-development/products/collections/list
* description: "Storefront guide: How to retrieve a list of collections."
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -14,6 +14,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -5,6 +5,14 @@
* description: Retrieve a list of currencies. The currencies can be filtered by fields such as `code`. The currencies can also be sorted or paginated.
* x-authenticated: false
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -9,6 +9,14 @@
* url: https://docs.medusajs.com/v2/resources/storefront-development/customers/retrieve
* description: "Storefront guide: How to retrieve the logged-in customer."
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -9,6 +9,14 @@
* url: https://docs.medusajs.com/v2/resources/storefront-development/customers/addresses#list-customer-addresses
* description: "Storefront guide: How to retrieve the logged-in customer's addresses."
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -12,6 +12,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -6,6 +6,14 @@
* description: Retrieve the orders of the logged-in customer. The orders can be filtered by fields such as `id`. The orders can also be sorted or paginated.
* x-authenticated: true
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -8,6 +8,14 @@
* url: https://docs.medusajs.com/v2/resources/storefront-development/checkout/payment
* description: "Storefront guide: How to implement payment during checkout."
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -8,6 +8,14 @@
* url: https://docs.medusajs.com/v2/resources/storefront-development/products/categories/list
* description: "Storefront guide: How to retrieve a list of product categories."
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -14,6 +14,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -8,6 +8,14 @@
* url: https://docs.medusajs.com/v2/resources/storefront-development/products/price
* description: "Storefront guide: How to retrieve a product variants' prices."
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -14,6 +14,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
@@ -61,6 +69,36 @@
* type: string
* title: cart_id
* description: The ID of the customer's cart. If set, the cart's region and shipping address's country code and province are used instead of the `region_id`, `country_code`, and `province` properties.
* - name: limit
* in: query
* description: Limit the number of items returned in the list.
* required: false
* schema:
* type: number
* title: limit
* description: Limit the number of items returned in the list.
* externalDocs:
* url: "#pagination"
* - name: offset
* in: query
* description: The number of items to skip when retrieving a list.
* required: false
* schema:
* type: number
* title: offset
* description: The number of items to skip when retrieving a list.
* externalDocs:
* url: "#pagination"
* - name: order
* in: query
* description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.
* required: false
* schema:
* type: string
* title: order
* description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.
* externalDocs:
* url: "#pagination"
* x-codeSamples:
* - lang: Shell
* label: cURL

View File

@@ -8,6 +8,14 @@
* url: https://docs.medusajs.com/v2/resources/storefront-development/regions/list
* description: "Storefront guide: How to retrieve a list of regions."
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -5,6 +5,14 @@
* description: Retrieve a list of return reasons. The return reasons can be sorted or paginated.
* x-authenticated: false
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* description: "Storefront guide: How to implement shipping during checkout."
* x-authenticated: false
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -5,6 +5,14 @@
* description: Create a cart.
* x-authenticated: false
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -14,6 +14,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -15,6 +15,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: |-

View File

@@ -15,6 +15,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -21,6 +21,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -12,6 +12,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -15,6 +15,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -12,6 +12,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -8,6 +8,14 @@
* description: "Storefront guide: How to register a customer."
* x-authenticated: true
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -8,6 +8,14 @@
* description: "Storefront guide: How to edit a customer's profile."
* x-authenticated: true
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -9,6 +9,14 @@
* description: "Storefront guide: How to create an address for the logged-in customer."
* x-authenticated: true
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -15,6 +15,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -14,6 +14,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: |-

View File

@@ -12,6 +12,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: |-

View File

@@ -12,6 +12,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: |-

View File

@@ -13,6 +13,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: |-

View File

@@ -8,6 +8,14 @@
* description: "Storefront guide: How to implement payment during checkout."
* x-authenticated: false
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -16,6 +16,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default

View File

@@ -55,6 +55,15 @@
* "500":
* $ref: "#/components/responses/500_error"
* x-workflow: createAndCompleteReturnOrderWorkflow
* parameters:
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
*
*/

View File

@@ -11,6 +11,14 @@
* required: true
* schema:
* type: string
* - name: x-publishable-api-key
* in: header
* description: Publishable API Key created in the Medusa Admin.
* required: true
* schema:
* type: string
* externalDocs:
* url: https://docs.medusajs.com/api/store#publishable-api-key
* - name: fields
* in: query
* description: |-

View File

@@ -19,8 +19,13 @@
* title: id
* description: The price rule's ID.
* value:
* type: string
* title: value
* oneOf:
* - type: string
* title: value
* description: The price rule's value.
* - type: number
* title: value
* description: The price rule's value.
* description: The price rule's value.
* operator:
* type: string

View File

@@ -28,18 +28,8 @@
* description: The shipping option rule's operator.
* example: eq
* value:
* oneOf:
* - type: string
* title: value
* description: The rule's value.
* example: '"true"'
* - type: array
* description: The rule's values.
* items:
* type: string
* title: value
* description: A rule's value
* example: '"true"'
* type: string
* title: value
* shipping_option_id:
* type: string
* title: shipping_option_id

View File

@@ -45,7 +45,7 @@ type SchemaDescriptionOptions = {
export type OasArea = "admin" | "store"
type ParameterType = "query" | "path"
type ParameterType = "query" | "path" | "header"
type AuthRequests = {
exact?: string
@@ -281,6 +281,10 @@ class OasKindGenerator extends FunctionKindGenerator {
security: [],
}
// get header params
const headerParams = this.getHeaderParameters(oasPath)
oas.parameters?.push(...headerParams)
// retreive query and request parameters
const { queryParameters, requestSchema } = this.getRequestParameters({
node,
@@ -471,6 +475,11 @@ class OasKindGenerator extends FunctionKindGenerator {
// update path parameters
const newPathParameters = this.getPathParameters({ oasPath, tagName })
// get header params
const headerParams = this.getHeaderParameters(oasPath)
newPathParameters.push(...headerParams)
oas.parameters = this.updateParameters({
oldParameters: oas.parameters as OpenAPIV3.ParameterObject[],
newParameters: newPathParameters,
@@ -902,7 +911,7 @@ class OasKindGenerator extends FunctionKindGenerator {
/**
* The parameter type.
*/
type: "path" | "query"
type: ParameterType
/**
* The name of the parameter.
*/
@@ -1184,6 +1193,33 @@ class OasKindGenerator extends FunctionKindGenerator {
}
}
/**
* Retrieve the header parameters of the OAS route.
*
* @param oasPath - The OAS path.
* @returns The header parameters of the route.
*/
getHeaderParameters(oasPath: string): OpenAPIV3.ParameterObject[] {
if (!oasPath.startsWith("store")) {
return []
}
return [
this.getParameterObject({
type: "header",
name: "x-publishable-api-key",
description: "Publishable API Key created in the Medusa Admin.",
required: true,
schema: {
type: "string",
externalDocs: {
url: "https://docs.medusajs.com/api/store#publishable-api-key",
},
},
}),
]
}
/**
* Retrieve the response's status.
*
@@ -1895,9 +1931,13 @@ class OasKindGenerator extends FunctionKindGenerator {
if (!oldParameters) {
return newParameters || []
}
const oppositeParamType = type === "query" ? "path" : "query"
const oppositeParamType = ["path", "query", "header"].filter(
(item) => item !== type
) as ParameterType[]
const oppositeParams: OpenAPIV3.ParameterObject[] =
oldParameters?.filter((param) => param.in === oppositeParamType) || []
oldParameters?.filter((param) =>
oppositeParamType.includes(param.in as ParameterType)
) || []
// check and update/add parameters if necessary
const existingParams: OpenAPIV3.ParameterObject[] =
oldParameters?.filter((param) => param.in === type) || []
@@ -1979,7 +2019,9 @@ class OasKindGenerator extends FunctionKindGenerator {
...oppositeParams,
...(existingParams?.filter(
(parameter) =>
(parameter as OpenAPIV3.ParameterObject).in === oppositeParamType ||
oppositeParamType.includes(
(parameter as OpenAPIV3.ParameterObject).in as ParameterType
) ||
!paramsToRemove.has((parameter as OpenAPIV3.ParameterObject).name)
) || []),
]