oas: [2/n] improve schema oas (#9040)

This commit is contained in:
Shahed Nasser
2024-09-06 18:53:07 +03:00
committed by GitHub
parent 0482b7751d
commit 7a80593b68
20 changed files with 168 additions and 204 deletions

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCollectionResponse
* type: object
* description: SUMMARY
* description: The collection's details.
* x-schemaName: AdminCollectionResponse
* required:
* - collection

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateApiKey
* type: object
* description: SUMMARY
* description: The API key's details.
* x-schemaName: AdminCreateApiKey
* required:
* - title
@@ -10,10 +10,10 @@
* title:
* type: string
* title: title
* description: The api key's title.
* description: The API key's title.
* type:
* type: string
* description: The api key's type.
* description: The API key's type. Use `secret` for a user's API key; Use `publishable` for Publishable API keys.
* enum:
* - publishable
* - secret

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateApplicationMethod
* type: object
* description: The promotion's application method.
* description: The application method's details.
* x-schemaName: AdminCreateApplicationMethod
* required:
* - value
@@ -15,7 +15,7 @@
* value:
* type: number
* title: value
* description: The application method's value.
* description: The discounted amount applied by the associated promotion based on the `type`.
* currency_code:
* type: string
* title: currency_code
@@ -23,23 +23,23 @@
* max_quantity:
* type: number
* title: max_quantity
* description: The application method's max quantity.
* description: The max quantity allowed in the cart for the associated promotion to be applied.
* type:
* type: string
* description: The application method's type.
* description: The type of the application method indicating how the associated promotion is applied.
* enum:
* - fixed
* - percentage
* target_type:
* type: string
* description: The application method's target type.
* description: The target type of the application method indicating whether the associated promotion is applied to the cart's items, shipping methods, or the whole order.
* enum:
* - items
* - shipping_methods
* - order
* allocation:
* type: string
* description: The application method's allocation.
* description: The allocation value that indicates whether the associated promotion is applied on each item in a cart or split between the items in the cart.
* enum:
* - each
* - across
@@ -56,11 +56,11 @@
* apply_to_quantity:
* type: number
* title: apply_to_quantity
* description: The application method's apply to quantity.
* description: The quantity that results from matching the `buyget` promotion's condition. For example, if the promotion is a "Buy 2 shirts get 1 free", the value f this attribute is `1`.
* buy_rules_min_quantity:
* type: number
* title: buy_rules_min_quantity
* description: The application method's buy rules min quantity.
* description: The minimum quantity required for a `buyget` promotion to be applied. For example, if the promotion is a "Buy 2 shirts get 1 free", the value of this attribute is `2`.
*
*/

View File

@@ -1,53 +0,0 @@
/**
* @schema AdminCreateCampaign
* type: object
* description: The promotion's campaign.
* x-schemaName: AdminCreateCampaign
* properties:
* name:
* type: string
* title: name
* description: The campaign's name.
* description:
* type: string
* title: description
* description: The campaign's description.
* currency:
* type: string
* title: currency
* description: The campaign's currency.
* campaign_identifier:
* type: string
* title: campaign_identifier
* description: The campaign's campaign identifier.
* starts_at:
* type: string
* title: starts_at
* description: The campaign's starts at.
* format: date-time
* ends_at:
* type: string
* title: ends_at
* description: The campaign's ends at.
* format: date-time
* budget:
* type: object
* description: The campaign's budget.
* properties:
* type:
* type: string
* description: The budget's type.
* enum:
* - spend
* - usage
* currency_code:
* type: string
* title: currency_code
* description: The budget's currency code.
* limit:
* type: number
* title: limit
* description: The budget's limit.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateCollection
* type: object
* description: SUMMARY
* description: the product collection's details.
* x-schemaName: AdminCreateCollection
* required:
* - title
@@ -16,7 +16,7 @@
* description: The collection's handle.
* metadata:
* type: object
* description: The collection's metadata.
* description: The collection's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateCustomerGroup
* type: object
* description: SUMMARY
* description: The customer group's details.
* x-schemaName: AdminCreateCustomerGroup
* required:
* - name
@@ -12,7 +12,7 @@
* description: The customer group's name.
* metadata:
* type: object
* description: The customer group's metadata.
* description: The customer group's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateFulfillment
* type: object
* description: SUMMARY
* description: The filfillment's details.
* x-schemaName: AdminCreateFulfillment
* required:
* - location_id
@@ -17,27 +17,27 @@
* location_id:
* type: string
* title: location_id
* description: The fulfillment's location id.
* description: The ID of the location the items are fulfilled from.
* provider_id:
* type: string
* title: provider_id
* description: The fulfillment's provider id.
* description: The ID of the provider handling this fulfillment.
* delivery_address:
* type: object
* description: The fulfillment's delivery address.
* description: The address to deliver the items to.
* properties:
* first_name:
* type: string
* title: first_name
* description: The delivery address's first name.
* description: The customer's first name.
* last_name:
* type: string
* title: last_name
* description: The delivery address's last name.
* description: The customer's last name.
* phone:
* type: string
* title: phone
* description: The delivery address's phone.
* description: The customer's phone.
* company:
* type: string
* title: company
@@ -45,11 +45,11 @@
* address_1:
* type: string
* title: address_1
* description: The delivery address's address 1.
* description: The delivery address's first line.
* address_2:
* type: string
* title: address_2
* description: The delivery address's address 2.
* description: The delivery address's second line.
* city:
* type: string
* title: city
@@ -68,13 +68,13 @@
* description: The delivery address's postal code.
* metadata:
* type: object
* description: The delivery address's metadata.
* description: The delivery address's metadata, used to store custom key-value pairs.
* items:
* type: array
* description: The fulfillment's items.
* description: The items to fulfill.
* items:
* type: object
* description: The item's items.
* description: An item to fulfill.
* required:
* - title
* - sku
@@ -88,11 +88,11 @@
* sku:
* type: string
* title: sku
* description: The item's sku.
* description: The item's SKU.
* quantity:
* type: number
* title: quantity
* description: The item's quantity.
* description: The quantity to fulfill of the item.
* barcode:
* type: string
* title: barcode
@@ -100,17 +100,17 @@
* line_item_id:
* type: string
* title: line_item_id
* description: The item's line item id.
* description: The ID of the associated line item.
* inventory_item_id:
* type: string
* title: inventory_item_id
* description: The item's inventory item id.
* description: The ID of the inventory item associated with the underlying variant.
* labels:
* type: array
* description: The fulfillment's labels.
* description: The labels for the fulfillment's shipments.
* items:
* type: object
* description: The label's labels.
* description: A shipment's label.
* required:
* - tracking_number
* - tracking_url
@@ -123,48 +123,48 @@
* tracking_url:
* type: string
* title: tracking_url
* description: The label's tracking url.
* description: The label's tracking URL.
* label_url:
* type: string
* title: label_url
* description: The label's label url.
* order:
* type: object
* description: The fulfillment's order.
* description: The label's URL.
* order_id:
* type: string
* title: order_id
* description: The fulfillment's order id.
* description: The ID of the order this fulfillment is created for.
* shipping_option_id:
* type: string
* title: shipping_option_id
* description: The fulfillment's shipping option id.
* description: The ID of the shipping option used in the order.
* data:
* type: object
* description: The fulfillment's data.
* description: Any data useful for the fulfillment provider to handle the fulfillment.
* externalDocs:
* url: https://docs.medusajs.com/v2/resources/commerce-modules/fulfillment/shipping-option#data-property
* description: Learn more about the data property.
* packed_at:
* type: string
* title: packed_at
* description: The fulfillment's packed at.
* description: The date and time the fulfillment was packed.
* format: date-time
* shipped_at:
* type: string
* title: shipped_at
* description: The fulfillment's shipped at.
* description: The date and time the fulfillment was shipped.
* format: date-time
* delivered_at:
* type: string
* title: delivered_at
* description: The fulfillment's delivered at.
* description: The date and time the fulfillment was delivered.
* format: date-time
* canceled_at:
* type: string
* title: canceled_at
* description: The fulfillment's canceled at.
* description: The date and time the fulfillment was canceled.
* format: date-time
* metadata:
* type: object
* description: The fulfillment's metadata.
* description: The fulfillment's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,17 +1,17 @@
/**
* @schema AdminCreateInventoryItem
* type: object
* description: SUMMARY
* description: The inventory item's details.
* x-schemaName: AdminCreateInventoryItem
* properties:
* sku:
* type: string
* title: sku
* description: The inventory item's sku.
* description: The inventory item's SKU.
* hs_code:
* type: string
* title: hs_code
* description: The inventory item's hs code.
* description: The inventory item's HS code.
* weight:
* type: number
* title: weight
@@ -47,18 +47,18 @@
* description:
* type: string
* title: description
* description: The inventory item's description.
* description: The description of the variant associated with the inventory item.
* requires_shipping:
* type: boolean
* title: requires_shipping
* description: The inventory item's requires shipping.
* description: Whether the item requires shipping.
* thumbnail:
* type: string
* title: thumbnail
* description: The inventory item's thumbnail.
* metadata:
* type: object
* description: The inventory item's metadata.
* description: The inventory item's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreatePriceList
* type: object
* description: SUMMARY
* description: The price list's details.
* x-schemaName: AdminCreatePriceList
* required:
* - title
@@ -18,11 +18,13 @@
* starts_at:
* type: string
* title: starts_at
* description: The price list's starts at.
* description: The date and time the price list starts at.
* format: date-time
* ends_at:
* type: string
* title: ends_at
* description: The price list's ends at.
* description: The date and time the price list ends at.
* format: date-time
* status:
* type: string
* description: The price list's status.
@@ -38,12 +40,14 @@
* rules:
* type: object
* description: The price list's rules.
* example:
* product_category_id: pcat_123
* prices:
* type: array
* description: The price list's prices.
* items:
* type: object
* description: The price's prices.
* description: A price's details.
* required:
* - currency_code
* - amount
@@ -60,18 +64,20 @@
* variant_id:
* type: string
* title: variant_id
* description: The price's variant id.
* description: The ID of the product variant this price is for.
* min_quantity:
* type: number
* title: min_quantity
* description: The price's min quantity.
* description: The minimum quantity required in the cart for this price to be applied.
* max_quantity:
* type: number
* title: max_quantity
* description: The price's max quantity.
* description: The maximum quantity in the cart that shouldn't be crossed for this price to be applied.
* rules:
* type: object
* description: The price's rules.
* example:
* region_id: reg_123
*
*/

View File

@@ -1,21 +1,23 @@
/**
* @schema AdminCreatePricePreference
* type: object
* description: SUMMARY
* description: The price preference's details.
* x-schemaName: AdminCreatePricePreference
* properties:
* attribute:
* type: string
* title: attribute
* description: The price preference's attribute.
* description: The name of the attribute the price preference applies on.
* example: currency_code
* value:
* type: string
* title: value
* description: The price preference's value.
* description: The attribute's value.
* example: usd
* is_tax_inclusive:
* type: boolean
* title: is_tax_inclusive
* description: The price preference's is tax inclusive.
* description: Whether the price is tax inclusive if the value of the specified attribute matches the specified value.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateProduct
* type: object
* description: The create's details.
* description: The product's details.
* x-schemaName: AdminCreateProduct
* required:
* - title
@@ -9,47 +9,47 @@
* title:
* type: string
* title: title
* description: The create's title.
* description: The product's title.
* subtitle:
* type: string
* title: subtitle
* description: The create's subtitle.
* description: The product's subtitle.
* description:
* type: string
* title: description
* description: The create's description.
* description: The product's description.
* is_giftcard:
* type: boolean
* title: is_giftcard
* description: The create's is giftcard.
* description: Whether the product is a gift card.
* discountable:
* type: boolean
* title: discountable
* description: The create's discountable.
* description: Whether the product is discountable.
* images:
* type: array
* description: The create's images.
* description: The product's images.
* items:
* type: object
* description: The image's images.
* description: A product's image details.
* required:
* - url
* properties:
* url:
* type: string
* title: url
* description: The image's url.
* description: The image's URL.
* thumbnail:
* type: string
* title: thumbnail
* description: The create's thumbnail.
* description: The URL of the product's thumbnail.
* handle:
* type: string
* title: handle
* description: The create's handle.
* description: The product's handle.
* status:
* type: string
* description: The create's status.
* description: The product's status.
* enum:
* - draft
* - proposed
@@ -58,17 +58,17 @@
* type_id:
* type: string
* title: type_id
* description: The create's type id.
* description: The ID of the type the product belongs to.
* collection_id:
* type: string
* title: collection_id
* description: The create's collection id.
* description: The ID of the collection the product belongs to.
* categories:
* type: array
* description: The create's categories.
* description: The categories the product belongs to.
* items:
* type: object
* description: The category's categories.
* description: A category's details.
* required:
* - id
* properties:
@@ -78,10 +78,10 @@
* description: The category's ID.
* tags:
* type: array
* description: The create's tags.
* description: The product's tags.
* items:
* type: object
* description: The tag's tags.
* description: A tag's details.
* required:
* - id
* properties:
@@ -91,20 +91,20 @@
* description: The tag's ID.
* options:
* type: array
* description: The create's options.
* description: The product's options.
* items:
* $ref: "#/components/schemas/AdminCreateProductOption"
* variants:
* type: array
* description: The create's variants.
* description: The product's variants.
* items:
* $ref: "#/components/schemas/AdminCreateProductVariant"
* sales_channels:
* type: array
* description: The create's sales channels.
* description: The sales channels the product is available in.
* items:
* type: object
* description: The sales channel's sales channels.
* description: A sales channel's details.
* required:
* - id
* properties:
@@ -115,38 +115,38 @@
* weight:
* type: number
* title: weight
* description: The create's weight.
* description: The product's weight.
* length:
* type: number
* title: length
* description: The create's length.
* description: The product's length.
* height:
* type: number
* title: height
* description: The create's height.
* description: The product's height.
* width:
* type: number
* title: width
* description: The create's width.
* description: The product's width.
* hs_code:
* type: string
* title: hs_code
* description: The create's hs code.
* description: The product's HS code.
* mid_code:
* type: string
* title: mid_code
* description: The create's mid code.
* description: The product's MID code.
* origin_country:
* type: string
* title: origin_country
* description: The create's origin country.
* description: The product's origin country.
* material:
* type: string
* title: material
* description: The create's material.
* description: The product's material.
* metadata:
* type: object
* description: The create's metadata.
* description: The product's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateProductCategory
* type: object
* description: SUMMARY
* description: The product category's details.
* x-schemaName: AdminCreateProductCategory
* required:
* - name
@@ -21,22 +21,22 @@
* is_internal:
* type: boolean
* title: is_internal
* description: The product category's is internal.
* description: Whether the product category is only used and seen by admin users.
* is_active:
* type: boolean
* title: is_active
* description: The product category's is active.
* description: Whether the product category is active.
* parent_category_id:
* type: string
* title: parent_category_id
* description: The product category's parent category id.
* description: The ID of a category that's the parent of this one.
* rank:
* type: number
* title: rank
* description: The product category's rank.
* description: The sorting order of the product category among sibling categories.
* metadata:
* type: object
* description: The product category's metadata.
* description: The product category's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateProductOption
* type: object
* description: SUMMARY
* description: The product option's details.
* x-schemaName: AdminCreateProductOption
* required:
* - title
@@ -10,14 +10,14 @@
* title:
* type: string
* title: title
* description: The product's title.
* description: The product option's title.
* values:
* type: array
* description: The product's values.
* description: The product option's values.
* items:
* type: string
* title: values
* description: The value's values.
* description: A value.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateProductTag
* type: object
* description: SUMMARY
* description: The product tag's details.
* x-schemaName: AdminCreateProductTag
* required:
* - value
@@ -12,7 +12,7 @@
* description: The product tag's value.
* metadata:
* type: object
* description: The product tag's metadata.
* description: The product tag's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateProductVariant
* type: object
* description: The create's details.
* description: The product variant's details.
* x-schemaName: AdminCreateProductVariant
* required:
* - title
@@ -10,78 +10,79 @@
* title:
* type: string
* title: title
* description: The create's title.
* description: The variant's title.
* sku:
* type: string
* title: sku
* description: The create's sku.
* description: The variant's SKU.
* ean:
* type: string
* title: ean
* description: The create's ean.
* description: The variant's EAN.
* upc:
* type: string
* title: upc
* description: The create's upc.
* description: The variant's UPC.
* barcode:
* type: string
* title: barcode
* description: The create's barcode.
* description: The variant's barcode.
* hs_code:
* type: string
* title: hs_code
* description: The create's hs code.
* description: The variant's HS code.
* mid_code:
* type: string
* title: mid_code
* description: The create's mid code.
* description: The variant's MID code.
* allow_backorder:
* type: boolean
* title: allow_backorder
* description: The create's allow backorder.
* description: Whether it's allowed to order this variant when it's out of stock.
* manage_inventory:
* type: boolean
* title: manage_inventory
* description: The create's manage inventory.
* description: Whether Medusa manages the variant's inventory quantity. If disabled, the product variant is always considered in stock.
* variant_rank:
* type: number
* title: variant_rank
* description: The create's variant rank.
* description: The sorting order of the variant among other variants in the product.
* weight:
* type: number
* title: weight
* description: The create's weight.
* description: The variant's weight.
* length:
* type: number
* title: length
* description: The create's length.
* description: The variant's length.
* height:
* type: number
* title: height
* description: The create's height.
* description: The variant's height.
* width:
* type: number
* title: width
* description: The create's width.
* description: The variant's width.
* origin_country:
* type: string
* title: origin_country
* description: The create's origin country.
* description: The variant's origin country.
* material:
* type: string
* title: material
* description: The create's material.
* description: The variant's material.
* metadata:
* type: object
* description: The create's metadata.
* description: The variant's metadata, used to store custom key-value pairs.
* prices:
* type: array
* description: The create's prices.
* description: The variant's prices.
* items:
* $ref: "#/components/schemas/AdminCreateProductVariantPrice"
* options:
* type: object
* description: The create's options.
*
* description: The variant's options, where the key is an option's name, and the value is the option's value.
* example:
* Color: Black
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateProductVariantPrice
* type: object
* description: The price's prices.
* description: The details of a variant's price.
* x-schemaName: AdminCreateProductVariantPrice
* required:
* - currency_code
@@ -18,14 +18,16 @@
* min_quantity:
* type: number
* title: min_quantity
* description: The price's min quantity.
* description: The minimum quantity that must be available in the cart for this price to apply.
* max_quantity:
* type: number
* title: max_quantity
* description: The price's max quantity.
* description: The maximum quantity that must not be surpassed in the cart for this price to apply.
* rules:
* type: object
* description: The price's rules.
* example:
* region_id: reg_123
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreatePromotionRule
* type: object
* description: The rule's rules.
* description: The promotion rule's details.
* x-schemaName: AdminCreatePromotionRule
* required:
* - operator
@@ -10,7 +10,7 @@
* properties:
* operator:
* type: string
* description: The rule's operator.
* description: The operator used to check whether the buy rule applies on a cart. For example, `eq` means that the cart's value for the specified attribute must match the specified value.
* enum:
* - gt
* - lt
@@ -26,18 +26,21 @@
* attribute:
* type: string
* title: attribute
* description: The rule's attribute.
* description: The attribute to compare against when checking whether a promotion can be applied on a cart.
* example: item.product.id
* values:
* oneOf:
* - type: string
* title: values
* description: The rule's values.
* description: The attribute's value.
* example: prod_123
* - type: array
* description: The rule's values.
* description: The allowed attribute values.
* items:
* type: string
* title: values
* description: The value's values.
* description: An attribute value.
* example: prod_123
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateRefundReason
* type: object
* description: SUMMARY
* description: The refund reason's details.
* x-schemaName: AdminCreateRefundReason
* required:
* - label

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateRegion
* type: object
* description: SUMMARY
* description: The region's details.
* x-schemaName: AdminCreateRegion
* required:
* - name
@@ -15,31 +15,34 @@
* type: string
* title: currency_code
* description: The region's currency code.
* example: usd
* countries:
* type: array
* description: The region's countries.
* items:
* type: string
* title: countries
* description: The country's countries.
* description: A country code.
* example: us
* automatic_taxes:
* type: boolean
* title: automatic_taxes
* description: The region's automatic taxes.
* description: Whether taxes are calculated automatically during checkout in this region.
* is_tax_inclusive:
* type: boolean
* title: is_tax_inclusive
* description: The region's is tax inclusive.
* description: Whether prices in this region are tax inclusive.
* payment_providers:
* type: array
* description: The region's payment providers.
* description: The payment providers enabled in this region.
* items:
* type: string
* title: payment_providers
* description: The payment provider's payment providers.
* description: A payment provider's ID.
* example: pp_stripe_stripe
* metadata:
* type: object
* description: The region's metadata.
* description: The region's metadata, used to store custom key-value pairs.
*
*/

View File

@@ -1,7 +1,7 @@
/**
* @schema AdminCreateReservation
* type: object
* description: SUMMARY
* description: The reservation's details.
* x-schemaName: AdminCreateReservation
* required:
* - location_id
@@ -11,26 +11,26 @@
* line_item_id:
* type: string
* title: line_item_id
* description: The reservation's line item id.
* description: The ID of the line item this reservation is created for.
* location_id:
* type: string
* title: location_id
* description: The reservation's location id.
* description: The ID of the location the quantity is reserved from.
* inventory_item_id:
* type: string
* title: inventory_item_id
* description: The reservation's inventory item id.
* description: The ID of the inventory item associated with the line item's variant.
* quantity:
* type: number
* title: quantity
* description: The reservation's quantity.
* description: The reserved quantity.
* description:
* type: string
* title: description
* description: The reservation's description.
* metadata:
* type: object
* description: The reservation's metadata.
* description: The reservation's metadata, used to store custom key-value pairs.
*
*/