oas: [3/n] improve oas schemas (#9042)

Improve oas schemas [3/n]
This commit is contained in:
Shahed Nasser
2024-09-07 06:16:00 +00:00
committed by GitHub
parent a7180e29b8
commit 4b8d9cc735
20 changed files with 285 additions and 97 deletions
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateSalesChannel * @schema AdminCreateSalesChannel
* type: object * type: object
* description: SUMMARY * description: The sales channel's details.
* x-schemaName: AdminCreateSalesChannel * x-schemaName: AdminCreateSalesChannel
* required: * required:
* - name * - name
@@ -17,10 +17,10 @@
* is_disabled: * is_disabled:
* type: boolean * type: boolean
* title: is_disabled * title: is_disabled
* description: The sales channel's is disabled. * description: Whether the sales channel is disabled.
* metadata: * metadata:
* type: object * type: object
* description: The sales channel's metadata. * description: The sales channel's metadata, used to store custom key-value pairs.
* *
*/ */
@@ -1,17 +1,17 @@
/** /**
* @schema AdminCreateShipment * @schema AdminCreateShipment
* type: object * type: object
* description: SUMMARY * description: The shipment's details.
* x-schemaName: AdminCreateShipment * x-schemaName: AdminCreateShipment
* required: * required:
* - labels * - labels
* properties: * properties:
* labels: * labels:
* type: array * type: array
* description: The fulfillment's labels. * description: The shipment's labels.
* items: * items:
* type: object * type: object
* description: The label's labels. * description: A shipment label's details.
* required: * required:
* - tracking_number * - tracking_number
* - tracking_url * - tracking_url
@@ -24,11 +24,11 @@
* tracking_url: * tracking_url:
* type: string * type: string
* title: tracking_url * title: tracking_url
* description: The label's tracking url. * description: The label's tracking URL.
* label_url: * label_url:
* type: string * type: string
* title: label_url * title: label_url
* description: The label's label url. * description: The label's URL.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateShippingOption * @schema AdminCreateShippingOption
* type: object * type: object
* description: SUMMARY * description: The shipping option's details.
* x-schemaName: AdminCreateShippingOption * x-schemaName: AdminCreateShippingOption
* required: * required:
* - name * - name
@@ -19,33 +19,38 @@
* service_zone_id: * service_zone_id:
* type: string * type: string
* title: service_zone_id * title: service_zone_id
* description: The shipping option's service zone id. * description: The ID of the service zone this shipping option belongs to.
* shipping_profile_id: * shipping_profile_id:
* type: string * type: string
* title: shipping_profile_id * title: shipping_profile_id
* description: The shipping option's shipping profile id. * description: The ID of the shipping profile this shipping option belongs to.
* data: * data:
* type: object * type: object
* description: The shipping option's data. * description: Any data necessary for fulfillment providers to handle shipping methods and fulfillments of this shipping option.
* externalDocs:
* url: https://docs.medusajs.com/v2/resources/commerce-modules/fulfillment/shipping-option#data-property
* description: Learn more about the data property.
* price_type: * price_type:
* type: string * type: string
* description: The shipping option's price type. * description: >
* The shipping option price's type. If `flat`, it means the option has a fixed price set in the `prices` property.
* `calculated` means that the shipping option's price is calculated during checkout.
* enum: * enum:
* - flat * - flat
* - calculated * - calculated
* provider_id: * provider_id:
* type: string * type: string
* title: provider_id * title: provider_id
* description: The shipping option's provider id. * description: The ID of the fulfillment provider used to handle this shipping option and its associated methods and fulfillments.
* type: * type:
* $ref: "#/components/schemas/AdminCreateShippingOption" * $ref: "#/components/schemas/AdminCreateShippingOption"
* prices: * prices:
* type: array * type: array
* description: The shipping option's prices. * description: The shipping option's prices. If `price_type` is `calculated`, pass an empty array for this property.
* items: * items:
* oneOf: * oneOf:
* - type: object * - type: object
* description: The price's prices. * description: The price for a currency code.
* x-schemaName: AdminCreateShippingOptionPriceWithCurrency * x-schemaName: AdminCreateShippingOptionPriceWithCurrency
* required: * required:
* - currency_code * - currency_code
@@ -60,7 +65,7 @@
* title: amount * title: amount
* description: The price's amount. * description: The price's amount.
* - type: object * - type: object
* description: The price's prices. * description: The price in a region.
* x-schemaName: AdminCreateShippingOptionPriceWithRegion * x-schemaName: AdminCreateShippingOptionPriceWithRegion
* required: * required:
* - region_id * - region_id
@@ -69,7 +74,7 @@
* region_id: * region_id:
* type: string * type: string
* title: region_id * title: region_id
* description: The price's region id. * description: The ID of the region this price is used in.
* amount: * amount:
* type: number * type: number
* title: amount * title: amount
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateShippingOptionRule * @schema AdminCreateShippingOptionRule
* type: object * type: object
* description: The rule's rules. * description: The details of the shipping option rule.
* x-schemaName: AdminCreateShippingOptionRule * x-schemaName: AdminCreateShippingOptionRule
* required: * required:
* - operator * - operator
@@ -10,7 +10,7 @@
* properties: * properties:
* operator: * operator:
* type: string * type: string
* description: The rule's operator. * description: The operator used to check whether a rule applies.
* enum: * enum:
* - gt * - gt
* - lt * - lt
@@ -23,18 +23,21 @@
* attribute: * attribute:
* type: string * type: string
* title: attribute * title: attribute
* description: The rule's attribute. * description: The name of a property or table that the rule applies to.
* example: customer_group
* value: * value:
* oneOf: * oneOf:
* - type: string * - type: string
* title: value * title: value
* description: The rule's value. * description: A value of the attribute that enables this rule.
* example: cusgroup_123
* - type: array * - type: array
* description: The rule's value. * description: Values of the attribute that enable this rule.
* items: * items:
* type: string * type: string
* title: value * title: value
* description: The value's details. * description: A value of the attribute that enables this rule.
* example: cusgroup_123
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateShippingProfile * @schema AdminCreateShippingProfile
* type: object * type: object
* description: SUMMARY * description: The shipping profile's details.
* x-schemaName: AdminCreateShippingProfile * x-schemaName: AdminCreateShippingProfile
* required: * required:
* - name * - name
@@ -17,7 +17,7 @@
* description: The shipping profile's type. * description: The shipping profile's type.
* metadata: * metadata:
* type: object * type: object
* description: The shipping profile's metadata. * description: The shipping profile's metadata, used to store custom key-value pairs.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateStockLocation * @schema AdminCreateStockLocation
* type: object * type: object
* description: SUMMARY * description: The stock location's details.
* x-schemaName: AdminCreateStockLocation * x-schemaName: AdminCreateStockLocation
* required: * required:
* - name * - name
@@ -13,12 +13,12 @@
* address_id: * address_id:
* type: string * type: string
* title: address_id * title: address_id
* description: The stock location's address id. * description: The ID of the stock location's address.
* address: * address:
* $ref: "#/components/schemas/AdminUpsertStockLocationAddress" * $ref: "#/components/schemas/AdminUpsertStockLocationAddress"
* metadata: * metadata:
* type: object * type: object
* description: The stock location's metadata. * description: The stock location's metadata, used to store custom key-value pairs.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateTaxRate * @schema AdminCreateTaxRate
* type: object * type: object
* description: SUMMARY * description: The tax rate's details.
* x-schemaName: AdminCreateTaxRate * x-schemaName: AdminCreateTaxRate
* required: * required:
* - name * - name
@@ -11,18 +11,20 @@
* type: string * type: string
* title: name * title: name
* description: The tax rate's name. * description: The tax rate's name.
* example: VAT
* tax_region_id: * tax_region_id:
* type: string * type: string
* title: tax_region_id * title: tax_region_id
* description: The tax rate's tax region id. * description: The ID of the tax region this rate belongs to.
* rate: * rate:
* type: number * type: number
* title: rate * title: rate
* description: The tax rate's rate. * description: The rate to charge.
* example: 10
* code: * code:
* type: string * type: string
* title: code * title: code
* description: The tax rate's code. * description: The code the tax rate is identified by.
* rules: * rules:
* type: array * type: array
* description: The tax rate's rules. * description: The tax rate's rules.
@@ -31,14 +33,16 @@
* is_default: * is_default:
* type: boolean * type: boolean
* title: is_default * title: is_default
* description: The tax rate's is default. * description: Whether the tax rate is the default in its tax region.
* is_combinable: * is_combinable:
* type: boolean * type: boolean
* title: is_combinable * title: is_combinable
* description: The tax rate's is combinable. * description: Whether the tax rate should be combined with parent rates.
* externalDocs:
* url: https://docs.medusajs.com/v2/resources/commerce-modules/tax/tax-rates-and-rules#combinable-tax-rates
* metadata: * metadata:
* type: object * type: object
* description: The tax rate's metadata. * description: The tax rate's metadata, used to store custom key-value pairs.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateTaxRateRule * @schema AdminCreateTaxRateRule
* type: object * type: object
* description: SUMMARY * description: The tax rate rule's details.
* x-schemaName: AdminCreateTaxRateRule * x-schemaName: AdminCreateTaxRateRule
* required: * required:
* - reference * - reference
@@ -10,11 +10,13 @@
* reference: * reference:
* type: string * type: string
* title: reference * title: reference
* description: The tax rate's reference. * description: The name of a table in the database that this rule points to.
* example: product_type
* reference_id: * reference_id:
* type: string * type: string
* title: reference_id * title: reference_id
* description: The tax rate's reference id. * description: The ID of a record in the table specified in reference.
* example: ptype_123
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateTaxRegion * @schema AdminCreateTaxRegion
* type: object * type: object
* description: SUMMARY * description: The tax region's details.
* x-schemaName: AdminCreateTaxRegion * x-schemaName: AdminCreateTaxRegion
* required: * required:
* - country_code * - country_code
@@ -10,6 +10,7 @@
* type: string * type: string
* title: country_code * title: country_code
* description: The tax region's country code. * description: The tax region's country code.
* example: us
* province_code: * province_code:
* type: string * type: string
* title: province_code * title: province_code
@@ -17,7 +18,7 @@
* parent_id: * parent_id:
* type: string * type: string
* title: parent_id * title: parent_id
* description: The tax region's parent id. * description: The ID of the parent tax region.
* default_tax_rate: * default_tax_rate:
* type: object * type: object
* description: The tax region's default tax rate. * description: The tax region's default tax rate.
@@ -27,25 +28,28 @@
* rate: * rate:
* type: number * type: number
* title: rate * title: rate
* description: The default tax rate's rate. * description: The rate to charge.
* example: 10
* code: * code:
* type: string * type: string
* title: code * title: code
* description: The default tax rate's code. * description: The code the tax rate is identified by
* name: * name:
* type: string * type: string
* title: name * title: name
* description: The default tax rate's name. * description: The default tax rate's name.
* example: VAT
* is_combinable: * is_combinable:
* type: boolean * type: boolean
* title: is_combinable * description: Whether the tax rate should be combined with parent rates.
* description: The default tax rate's is combinable. * externalDocs:
* url: https://docs.medusajs.com/v2/resources/commerce-modules/tax/tax-rates-and-rules#combinable-tax-rates
* metadata: * metadata:
* type: object * type: object
* description: The default tax rate's metadata. * description: The default tax rate's metadata, used to store custom key-value pairs.
* metadata: * metadata:
* type: object * type: object
* description: The tax region's metadata. * description: The tax region's metadata, used to store custom key-value pairs.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateVariantInventoryItem * @schema AdminCreateVariantInventoryItem
* type: object * type: object
* description: SUMMARY * description: The details of the variant-inventory item association.
* x-schemaName: AdminCreateVariantInventoryItem * x-schemaName: AdminCreateVariantInventoryItem
* required: * required:
* - required_quantity * - required_quantity
@@ -10,11 +10,11 @@
* required_quantity: * required_quantity:
* type: number * type: number
* title: required_quantity * title: required_quantity
* description: The product's required quantity. * description: The quantity of the variant in the inventory item.
* inventory_item_id: * inventory_item_id:
* type: string * type: string
* title: inventory_item_id * title: inventory_item_id
* description: The product's inventory item id. * description: The inventory item's ID.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCreateWorkflowsAsyncResponse * @schema AdminCreateWorkflowsAsyncResponse
* type: object * type: object
* description: SUMMARY * description: The details of changing a workflow execution's step status.
* x-schemaName: AdminCreateWorkflowsAsyncResponse * x-schemaName: AdminCreateWorkflowsAsyncResponse
* required: * required:
* - transaction_id * - transaction_id
@@ -10,16 +10,18 @@
* transaction_id: * transaction_id:
* type: string * type: string
* title: transaction_id * title: transaction_id
* description: The workflows execution's transaction id. * description: The workflows execution's transaction ID.
* step_id: * step_id:
* type: string * type: string
* title: step_id * title: step_id
* description: The workflows execution's step id. * description: The ID of the step whose status was changed.
* response: {} * response:
* compensate_input: {} * description: Sets the step's response. It accepts any type.
* compensate_input:
* description: Sets the compensation function's input. It accepts any response.
* action: * action:
* type: string * type: string
* description: The workflows execution's action. * description: Whether to invoke or compensate the step.
* enum: * enum:
* - invoke * - invoke
* - compensate * - compensate
@@ -1,14 +1,15 @@
/** /**
* @schema AdminCreateWorkflowsRun * @schema AdminCreateWorkflowsRun
* type: object * type: object
* description: SUMMARY * description: The details of the workflow to execute.
* x-schemaName: AdminCreateWorkflowsRun * x-schemaName: AdminCreateWorkflowsRun
* properties: * properties:
* input: {} * input:
* description: The input to pass to the workflow. Can be of any type.
* transaction_id: * transaction_id:
* type: string * type: string
* title: transaction_id * title: transaction_id
* description: The workflows execution's transaction id. * description: The ID of the workflow execution's transaction.
* *
*/ */
@@ -1,8 +1,62 @@
/** /**
* @schema AdminCurrency * @schema AdminCurrency
* type: object * type: object
* description: The supported currency's currency. * description: The currency's currencies.
* x-schemaName: AdminCurrency * x-schemaName: AdminCurrency
* required:
* - code
* - symbol
* - symbol_native
* - name
* - decimal_digits
* - rounding
* - raw_rounding
* - created_at
* - updated_at
* - deleted_at
* properties:
* code:
* type: string
* title: code
* description: The currency's code.
* example: usd
* symbol:
* type: string
* title: symbol
* description: The currency's symbol.
* example: $
* symbol_native:
* type: string
* title: symbol_native
* description: The currency's native symbol, if different than the symbol.
* example: $
* name:
* type: string
* title: name
* description: The currency's name.
* decimal_digits:
* type: number
* title: decimal_digits
* description: The number of digits after the decimal for prices in this currency.
* rounding:
* type: number
* title: rounding
* description: The rounding percision applied on prices in this currency.
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The currency's creation date.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The currency's update date.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The currency's deletion date.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCurrencyListResponse * @schema AdminCurrencyListResponse
* type: object * type: object
* description: SUMMARY * description: The paginated list of currencies.
* x-schemaName: AdminCurrencyListResponse * x-schemaName: AdminCurrencyListResponse
* required: * required:
* - limit * - limit
@@ -12,18 +12,18 @@
* limit: * limit:
* type: number * type: number
* title: limit * title: limit
* description: The currency's limit. * description: The maximum number of items returned.
* offset: * offset:
* type: number * type: number
* title: offset * title: offset
* description: The currency's offset. * description: The number of items skipped before retrieving the returned items.
* count: * count:
* type: number * type: number
* title: count * title: count
* description: The currency's count. * description: The total number of items.
* currencies: * currencies:
* type: array * type: array
* description: The currency's currencies. * description: The list of currencies.
* items: * items:
* $ref: "#/components/schemas/AdminCurrency" * $ref: "#/components/schemas/AdminCurrency"
* *
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCurrencyResponse * @schema AdminCurrencyResponse
* type: object * type: object
* description: SUMMARY * description: The currency's details.
* x-schemaName: AdminCurrencyResponse * x-schemaName: AdminCurrencyResponse
* required: * required:
* - currency * - currency
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCustomer * @schema AdminCustomer
* type: object * type: object
* description: The order's customer. * description: The customer's details.
* x-schemaName: AdminCustomer * x-schemaName: AdminCustomer
* required: * required:
* - has_account * - has_account
@@ -14,19 +14,19 @@
* - last_name * - last_name
* - addresses * - addresses
* properties: * properties:
* id:
* type: string
* title: id
* description: The customer's ID.
* has_account: * has_account:
* type: boolean * type: boolean
* title: has_account * title: has_account
* description: The customer's has account. * description: Whether the customer is registered.
* groups: * groups:
* type: array * type: array
* description: The customer's groups. * description: The customer's groups.
* items: * items:
* $ref: "#/components/schemas/AdminCustomerGroup" * $ref: "#/components/schemas/AdminCustomerGroup"
* id:
* type: string
* title: id
* description: The customer's ID.
* email: * email:
* type: string * type: string
* title: email * title: email
@@ -35,11 +35,11 @@
* default_billing_address_id: * default_billing_address_id:
* type: string * type: string
* title: default_billing_address_id * title: default_billing_address_id
* description: The customer's default billing address id. * description: The ID of the address used as the default billing address.
* default_shipping_address_id: * default_shipping_address_id:
* type: string * type: string
* title: default_shipping_address_id * title: default_shipping_address_id
* description: The customer's default shipping address id. * description: The ID of the address used as the default shipping address.
* company_name: * company_name:
* type: string * type: string
* title: company_name * title: company_name
@@ -63,26 +63,26 @@
* description: The customer's phone. * description: The customer's phone.
* metadata: * metadata:
* type: object * type: object
* description: The customer's metadata. * description: The customer's metadata, used to store custom key-value pairs.
* created_by: * created_by:
* type: string * type: string
* title: created_by * title: created_by
* description: The customer's created by. * description: The ID of the user that created this customer, if available.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The customer's deleted at.
* created_at: * created_at:
* type: string * type: string
* format: date-time * format: date-time
* title: created_at * title: created_at
* description: The customer's created at. * description: The customer's creation date.
* updated_at: * updated_at:
* type: string * type: string
* format: date-time * format: date-time
* title: updated_at * title: updated_at
* description: The customer's updated at. * description: The customer's update date.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The customer's deletion date.
* *
*/ */
@@ -30,39 +30,39 @@
* address_name: * address_name:
* type: string * type: string
* title: address_name * title: address_name
* description: The address's address name. * description: The address's name.
* is_default_shipping: * is_default_shipping:
* type: boolean * type: boolean
* title: is_default_shipping * title: is_default_shipping
* description: The address's is default shipping. * description: Whether the address is the default shipping address.
* is_default_billing: * is_default_billing:
* type: boolean * type: boolean
* title: is_default_billing * title: is_default_billing
* description: The address's is default billing. * description: Whether the address is the default billing address.
* customer_id: * customer_id:
* type: string * type: string
* title: customer_id * title: customer_id
* description: The address's customer id. * description: The ID of the customer that this address belongs to.
* company: * company:
* type: string * type: string
* title: company * title: company
* description: The address's company. * description: The customer's company.
* first_name: * first_name:
* type: string * type: string
* title: first_name * title: first_name
* description: The address's first name. * description: The customer's first name.
* last_name: * last_name:
* type: string * type: string
* title: last_name * title: last_name
* description: The address's last name. * description: The customer's last name.
* address_1: * address_1:
* type: string * type: string
* title: address_1 * title: address_1
* description: The address's address 1. * description: The address's first line.
* address_2: * address_2:
* type: string * type: string
* title: address_2 * title: address_2
* description: The address's address 2. * description: The address's second line.
* city: * city:
* type: string * type: string
* title: city * title: city
@@ -71,6 +71,7 @@
* type: string * type: string
* title: country_code * title: country_code
* description: The address's country code. * description: The address's country code.
* example: us
* province: * province:
* type: string * type: string
* title: province * title: province
@@ -85,17 +86,17 @@
* description: The address's phone. * description: The address's phone.
* metadata: * metadata:
* type: object * type: object
* description: The address's metadata. * description: The address's metadata, used to store custom key-value pairs.
* created_at: * created_at:
* type: string * type: string
* format: date-time * format: date-time
* title: created_at * title: created_at
* description: The address's created at. * description: The address's creation date.
* updated_at: * updated_at:
* type: string * type: string
* format: date-time * format: date-time
* title: updated_at * title: updated_at
* description: The address's updated at. * description: The address's update date.
* *
*/ */
@@ -1,7 +1,7 @@
/** /**
* @schema AdminCustomerAddressResponse * @schema AdminCustomerAddressResponse
* type: object * type: object
* description: SUMMARY * description: The address's details.
* x-schemaName: AdminCustomerAddressResponse * x-schemaName: AdminCustomerAddressResponse
* required: * required:
* - address * - address
@@ -1,8 +1,42 @@
/** /**
* @schema AdminCustomerGroup * @schema AdminCustomerGroup
* type: object * type: object
* description: The group's groups. * description: The customer group's details.
* x-schemaName: AdminCustomerGroup * x-schemaName: AdminCustomerGroup
* required:
* - id
* - name
* - customers
* - metadata
* - created_at
* - updated_at
* properties:
* id:
* type: string
* title: id
* description: The customer group's ID.
* name:
* type: string
* title: name
* description: The customer group's name.
* customers:
* type: array
* description: The customer group's customers.
* items:
* $ref: "#/components/schemas/BaseCustomer"
* metadata:
* type: object
* description: The customer group's metadata, used to store custom key-value pairs.
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The customer group's creation date.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The customer group's update date.
* *
*/ */
@@ -0,0 +1,78 @@
/**
* @schema BaseCustomer
* type: object
* description: The customer's details.
* x-schemaName: BaseCustomer
* required:
* - id
* - email
* - default_billing_address_id
* - default_shipping_address_id
* - company_name
* - first_name
* - last_name
* - addresses
* properties:
* id:
* type: string
* title: id
* description: The customer's ID.
* email:
* type: string
* title: email
* description: The customer's email.
* format: email
* default_billing_address_id:
* type: string
* title: default_billing_address_id
* description: The ID of the address used as the default billing address.
* default_shipping_address_id:
* type: string
* title: default_shipping_address_id
* description: The ID of the address used as the default shipping address.
* company_name:
* type: string
* title: company_name
* description: The customer's company name.
* first_name:
* type: string
* title: first_name
* description: The customer's first name.
* last_name:
* type: string
* title: last_name
* description: The customer's last name.
* addresses:
* type: array
* description: The customer's addresses.
* items:
* $ref: "#/components/schemas/BaseCustomerAddress"
* phone:
* type: string
* title: phone
* description: The customer's phone.
* metadata:
* type: object
* description: The customer's metadata, used to store custom key-value pairs.
* created_by:
* type: string
* title: created_by
* description: The ID of the user that created this customer, if available.
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The customer's creation date.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The customer's update date.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The customer's deletion date.
*
*/