feat(oas) - accurate model OAS representation - A to D (#3203)

### Scope

Models A to D

### What

Refactor OAS for models to accurately represent their shape in API responses.

### Why

About 33% of model fields are not accurately represented in the OAS. Most of the issues are:
- fields that can not be omitted in the response are not declared as `required`
- fields that could return `null` as their value are not declared as `nullable: true`

When using a code generator, these OAS issues would lead to inaccurate response shapes in the generated client.

### How

#### nullable
Fields meeting at least one of the following condition will be represented as `nullable: true` in OAS:
* The field is decorated with `@Column({ nullable: true })`
* The field is decorated with `@OneToOne`, `@ManyToOne`
* The field is decorated with `@DeleteDateColumn`

#### optional
Fields meeting at least one of the following conditions will never be listed as `required` in OAS and will be considered optional and could be omitted in the response:
* The field is decorated with `@OneToOne`, `@ManyToOne`, `@OneToMany`, `@ManyToMany`
* The field is decorated with `@FeatureFlagColumn`
* The field is decorated with `@Column({select: false})`
* The field is representing dynamic values not persisted in the database

Fields not meeting any of the conditions above will be declared as `required` and are expected to be present in the response.

### Test
* Ran OAS validator.
* Ran docs build script.

Expect OAS changes to be reflected in the API documentation.
This commit is contained in:
Patrick
2023-02-08 17:00:37 +00:00
committed by GitHub
parent f5dced6ad9
commit 4d3210bfbb
22 changed files with 582 additions and 308 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
feat(oas) - accurate model OAS representation - A to D
+47 -18
View File
@@ -126,66 +126,93 @@ export class Address extends SoftDeletableEntity {
* title: "Address" * title: "Address"
* description: "An address." * description: "An address."
* type: object * type: object
* required:
* - address_1
* - address_2
* - city
* - company
* - country_code
* - created_at
* - customer_id
* - deleted_at
* - first_name
* - id
* - last_name
* - metadata
* - phone
* - postal_code
* - province
* - updated_at
* properties: * properties:
* id: * id:
* type: string * type: string
* description: ID of the address * description: ID of the address
* example: addr_01G8ZC9VS1XVE149MGH2J7QSSH * example: addr_01G8ZC9VS1XVE149MGH2J7QSSH
* customer_id: * customer_id:
* type: string
* description: ID of the customer this address belongs to * description: ID of the customer this address belongs to
* nullable: true
* type: string
* example: cus_01G2SG30J8C85S4A5CHM2S1NS2 * example: cus_01G2SG30J8C85S4A5CHM2S1NS2
* customer: * customer:
* description: Available if the relation `customer` is expanded. * description: Available if the relation `customer` is expanded.
* type: array * nullable: true
* items: * $ref: "#/components/schemas/Customer"
* type: object
* description: A customer object.
* company: * company:
* type: string
* description: Company name * description: Company name
* nullable: true
* type: string
* example: Acme * example: Acme
* first_name: * first_name:
* type: string
* description: First name * description: First name
* nullable: true
* type: string
* example: Arno * example: Arno
* last_name: * last_name:
* type: string
* description: Last name * description: Last name
* nullable: true
* type: string
* example: Willms * example: Willms
* address_1: * address_1:
* type: string
* description: Address line 1 * description: Address line 1
* nullable: true
* type: string
* example: 14433 Kemmer Court * example: 14433 Kemmer Court
* address_2: * address_2:
* type: string
* description: Address line 2 * description: Address line 2
* nullable: true
* type: string
* example: Suite 369 * example: Suite 369
* city: * city:
* type: string
* description: City * description: City
* nullable: true
* type: string
* example: South Geoffreyview * example: South Geoffreyview
* country_code: * country_code:
* type: string
* description: The 2 character ISO code of the country in lower case * description: The 2 character ISO code of the country in lower case
* nullable: true
* type: string
* externalDocs: * externalDocs:
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
* description: See a list of codes. * description: See a list of codes.
* example: st * example: st
* country: * country:
* description: A country object. Available if the relation `country` is expanded. * description: A country object. Available if the relation `country` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Country"
* province: * province:
* type: string
* description: Province * description: Province
* nullable: true
* type: string
* example: Kentucky * example: Kentucky
* postal_code: * postal_code:
* type: string
* description: Postal Code * description: Postal Code
* nullable: true
* type: string
* example: 72093 * example: 72093
* phone: * phone:
* type: string
* description: Phone Number * description: Phone Number
* nullable: true
* type: string
* example: 16128234334802 * example: 16128234334802
* created_at: * created_at:
* type: string * type: string
@@ -196,11 +223,13 @@ export class Address extends SoftDeletableEntity {
* description: "The date with timezone at which the resource was updated." * description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+78 -49
View File
@@ -108,21 +108,36 @@ export class BatchJob extends SoftDeletableEntity {
* description: "A Batch Job." * description: "A Batch Job."
* type: object * type: object
* required: * required:
* - canceled_at
* - completed_at
* - confirmed_at
* - context
* - created_at
* - created_by
* - deleted_at
* - dry_run
* - failed_at
* - id
* - pre_processed_at
* - processing_at
* - result
* - status
* - type * - type
* - updated_at
* properties: * properties:
* id: * id:
* description: The unique identifier for the batch job.
* type: string * type: string
* description: "The unique identifier for the batch job."
* example: batch_01G8T782965PYFG0751G0Z38B4 * example: batch_01G8T782965PYFG0751G0Z38B4
* type: * type:
* description: The type of batch job.
* type: string * type: string
* description: "The type of batch job."
* enum: * enum:
* - product-import * - product-import
* - product-export * - product-export
* status: * status:
* description: The status of the batch job.
* type: string * type: string
* description: "The status of the batch job."
* enum: * enum:
* - created * - created
* - pre_processed * - pre_processed
@@ -133,15 +148,18 @@ export class BatchJob extends SoftDeletableEntity {
* - failed * - failed
* default: created * default: created
* created_by: * created_by:
* description: The unique identifier of the user that created the batch job.
* nullable: true
* type: string * type: string
* description: "The unique identifier of the user that created the batch job."
* example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V * example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
* created_by_user: * created_by_user:
* description: A user object. Available if the relation `created_by_user` is expanded. * description: A user object. Available if the relation `created_by_user` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/User"
* context: * context:
* description: The context of the batch job, the type of the batch job determines what the context should contain.
* nullable: true
* type: object * type: object
* description: "The context of the batch job, the type of the batch job determines what the context should contain."
* example: * example:
* shape: * shape:
* prices: * prices:
@@ -159,43 +177,47 @@ export class BatchJob extends SoftDeletableEntity {
* - variant.prices * - variant.prices
* - images * - images
* dry_run: * dry_run:
* description: Specify if the job must apply the modifications or not.
* type: boolean * type: boolean
* description: "Specify if the job must apply the modifications or not."
* default: false * default: false
* result: * result:
* type: object * description: The result of the batch job.
* description: "The result of the batch job." * nullable: true
* properties: * allOf:
* count: * - type: object
* type: number * example: {}
* advancement_count: * - type: object
* type: number * properties:
* progress: * count:
* type: number * type: number
* errors: * advancement_count:
* type: object * type: number
* properties: * progress:
* message: * type: number
* type: string * errors:
* code: * type: object
* oneOf: * properties:
* - type: string * message:
* - type: number * type: string
* err: * code:
* type: array * oneOf:
* stat_descriptors: * - type: string
* type: object * - type: number
* properties: * err:
* key: * type: array
* type: string * stat_descriptors:
* name: * type: object
* type: string * properties:
* message: * key:
* type: string * type: string
* file_key: * name:
* type: string * type: string
* file_size: * message:
* type: number * type: string
* file_key:
* type: string
* file_size:
* type: number
* example: * example:
* errors: * errors:
* - err: [] * - err: []
@@ -206,39 +228,46 @@ export class BatchJob extends SoftDeletableEntity {
* name: "Product count to export" * name: "Product count to export"
* message: "There will be 8 products exported by this action" * message: "There will be 8 products exported by this action"
* pre_processed_at: * pre_processed_at:
* description: The date from which the job has been pre-processed.
* nullable: true
* type: string * type: string
* description: "The date from which the job has been pre processed."
* format: date-time * format: date-time
* processing_at: * processing_at:
* description: The date the job is processing at.
* nullable: true
* type: string * type: string
* description: "The date the job is processing at."
* format: date-time * format: date-time
* confirmed_at: * confirmed_at:
* description: The date when the confirmation has been done.
* nullable: true
* type: string * type: string
* description: "The date when the confirmation has been done."
* format: date-time * format: date-time
* completed_at: * completed_at:
* description: The date of the completion.
* nullable: true
* type: string * type: string
* description: "The date of the completion."
* format: date-time * format: date-time
* canceled_at: * canceled_at:
* description: The date of the concellation.
* nullable: true
* type: string * type: string
* description: "The date of the concellation."
* format: date-time * format: date-time
* failed_at: * failed_at:
* description: The date when the job failed.
* nullable: true
* type: string * type: string
* description: "The date when the job failed."
* format: date-time * format: date-time
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was last updated.
* type: string * type: string
* description: "The date with timezone at which the resource was last updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
*/ */
+83 -40
View File
@@ -3,28 +3,51 @@
* title: "Cart" * title: "Cart"
* description: "Represents a user cart" * description: "Represents a user cart"
* type: object * type: object
* required:
* - billing_address_id
* - completed_at
* - context
* - created_at
* - customer_id
* - deleted_at
* - email
* - id
* - idempotency_key
* - metadata
* - payment_authorized_at
* - payment_id
* - payment_session
* - region_id
* - shipping_address_id
* - type
* - updated_at
* properties: * properties:
* id: * id:
* type: string
* description: The cart's ID * description: The cart's ID
* type: string
* example: cart_01G8ZH853Y6TFXWPG5EYE81X63 * example: cart_01G8ZH853Y6TFXWPG5EYE81X63
* email: * email:
* type: string
* description: The email associated with the cart * description: The email associated with the cart
* nullable: true
* type: string
* format: email * format: email
* billing_address_id: * billing_address_id:
* type: string
* description: The billing address's ID * description: The billing address's ID
* nullable: true
* type: string
* example: addr_01G8ZH853YPY9B94857DY91YGW * example: addr_01G8ZH853YPY9B94857DY91YGW
* billing_address: * billing_address:
* description: Available if the relation `billing_address` is expanded. * description: Available if the relation `billing_address` is expanded.
* nullable: true
* $ref: "#/components/schemas/Address" * $ref: "#/components/schemas/Address"
* shipping_address_id: * shipping_address_id:
* type: string
* description: The shipping address's ID * description: The shipping address's ID
* nullable: true
* type: string
* example: addr_01G8ZH853YPY9B94857DY91YGW * example: addr_01G8ZH853YPY9B94857DY91YGW
* shipping_address: * shipping_address:
* description: Available if the relation `shipping_address` is expanded. * description: Available if the relation `shipping_address` is expanded.
* nullable: true
* $ref: "#/components/schemas/Address" * $ref: "#/components/schemas/Address"
* items: * items:
* description: Available if the relation `items` is expanded. * description: Available if the relation `items` is expanded.
@@ -32,54 +55,58 @@
* items: * items:
* $ref: "#/components/schemas/LineItem" * $ref: "#/components/schemas/LineItem"
* region_id: * region_id:
* type: string
* description: The region's ID * description: The region's ID
* type: string
* example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
* region: * region:
* description: A region object. Available if the relation `region` is expanded. * description: A region object. Available if the relation `region` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Region"
* discounts: * discounts:
* type: array
* description: Available if the relation `discounts` is expanded. * description: Available if the relation `discounts` is expanded.
* items:
* type: object
* description: A discount object.
* gift_cards:
* type: array * type: array
* description: Available if the relation `gift_cards` is expanded.
* items: * items:
* type: object * $ref: "#/components/schemas/Discount"
* description: A gift card object. * gift_cards:
* description: Available if the relation `gift_cards` is expanded.
* type: array
* items:
* $ref: "#/components/schemas/GiftCard"
* customer_id: * customer_id:
* type: string
* description: The customer's ID * description: The customer's ID
* nullable: true
* type: string
* example: cus_01G2SG30J8C85S4A5CHM2S1NS2 * example: cus_01G2SG30J8C85S4A5CHM2S1NS2
* customer: * customer:
* description: A customer object. Available if the relation `customer` is expanded. * description: A customer object. Available if the relation `customer` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Customer"
* payment_session: * payment_session:
* description: The selected payment session in the cart. * description: The selected payment session in the cart.
* nullable: true
* $ref: "#/components/schemas/PaymentSession" * $ref: "#/components/schemas/PaymentSession"
* payment_sessions: * payment_sessions:
* type: array
* description: The payment sessions created on the cart. * description: The payment sessions created on the cart.
* type: array
* items: * items:
* $ref: "#/components/schemas/PaymentSession" * $ref: "#/components/schemas/PaymentSession"
* payment_id: * payment_id:
* type: string
* description: The payment's ID if available * description: The payment's ID if available
* nullable: true
* type: string
* example: pay_01G8ZCC5W42ZNY842124G7P5R9 * example: pay_01G8ZCC5W42ZNY842124G7P5R9
* payment: * payment:
* description: Available if the relation `payment` is expanded. * description: Available if the relation `payment` is expanded.
* nullable: true
* $ref: "#/components/schemas/Payment" * $ref: "#/components/schemas/Payment"
* shipping_methods: * shipping_methods:
* type: array
* description: The shipping methods added to the cart. * description: The shipping methods added to the cart.
* type: array
* items: * items:
* $ref: "#/components/schemas/ShippingMethod" * $ref: "#/components/schemas/ShippingMethod"
* type: * type:
* type: string
* description: The cart's type. * description: The cart's type.
* type: string
* enum: * enum:
* - default * - default
* - swap * - swap
@@ -88,83 +115,99 @@
* - claim * - claim
* default: default * default: default
* completed_at: * completed_at:
* description: The date with timezone at which the cart was completed.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the cart was completed."
* format: date-time * format: date-time
* payment_authorized_at: * payment_authorized_at:
* description: The date with timezone at which the payment was authorized.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the payment was authorized."
* format: date-time * format: date-time
* idempotency_key: * idempotency_key:
* type: string
* description: Randomly generated key used to continue the completion of a cart in case of failure. * description: Randomly generated key used to continue the completion of a cart in case of failure.
* nullable: true
* type: string
* externalDocs: * externalDocs:
* url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
* description: Learn more how to use the idempotency key. * description: Learn more how to use the idempotency key.
* context: * context:
* type: object
* description: "The context of the cart which can include info like IP or user agent." * description: "The context of the cart which can include info like IP or user agent."
* nullable: true
* type: object
* example: * example:
* ip: "::1" * ip: "::1"
* user_agent: "PostmanRuntime/7.29.2" * user_agent: "PostmanRuntime/7.29.2"
* sales_channel_id: * sales_channel_id:
* type: string
* description: The sales channel ID the cart is associated with. * description: The sales channel ID the cart is associated with.
* nullable: true
* type: string
* example: null * example: null
* sales_channel: * sales_channel:
* description: A sales channel object. Available if the relation `sales_channel` is expanded. * description: A sales channel object. Available if the relation `sales_channel` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/SalesChannel"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
* shipping_total: * shipping_total:
* type: integer
* description: The total of shipping * description: The total of shipping
* type: integer
* example: 1000 * example: 1000
* discount_total: * discount_total:
* type: integer
* description: The total of discount * description: The total of discount
* example: 800
* tax_total:
* type: integer * type: integer
* example: 800
* item_tax_total:
* description: The total of items with taxes
* type: integer
* example: 8000
* shipping_tax_total:
* description: The total of shipping with taxes
* type: integer
* example: 1000
* tax_total:
* description: The total of tax * description: The total of tax
* type: integer
* example: 0 * example: 0
* refunded_total: * refunded_total:
* type: integer
* description: The total amount refunded if the order associated with this cart is returned. * description: The total amount refunded if the order associated with this cart is returned.
* type: integer
* example: 0 * example: 0
* total: * total:
* type: integer
* description: The total amount of the cart * description: The total amount of the cart
* type: integer
* example: 8200 * example: 8200
* subtotal: * subtotal:
* type: integer
* description: The subtotal of the cart * description: The subtotal of the cart
* type: integer
* example: 8000 * example: 8000
* refundable_amount: * refundable_amount:
* type: integer
* description: The amount that can be refunded * description: The amount that can be refunded
* type: integer
* example: 8200 * example: 8200
* gift_card_total: * gift_card_total:
* type: integer
* description: The total of gift cards * description: The total of gift cards
* type: integer
* example: 0 * example: 0
* gift_card_tax_total: * gift_card_tax_total:
* type: integer
* description: The total of gift cards with taxes * description: The total of gift cards with taxes
* type: integer
* example: 0 * example: 0
*/ */
+18 -10
View File
@@ -40,37 +40,45 @@ export class ClaimImage extends SoftDeletableEntity {
* description: "Represents photo documentation of a claim." * description: "Represents photo documentation of a claim."
* type: object * type: object
* required: * required:
* - claim_item_id * - claim_item_id
* - url * - created_at
* - deleted_at
* - id
* - metadata
* - updated_at
* - url
* properties: * properties:
* id: * id:
* type: string
* description: The claim image's ID * description: The claim image's ID
* type: string
* example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 * example: cimg_01G8ZH853Y6TFXWPG5EYE81X63
* claim_item_id: * claim_item_id:
* type: string
* description: The ID of the claim item associated with the image * description: The ID of the claim item associated with the image
* type: string
* claim_item: * claim_item:
* description: A claim item object. Available if the relation `claim_item` is expanded. * description: A claim item object. Available if the relation `claim_item` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/ClaimItem"
* url: * url:
* type: string
* description: The URL of the image * description: The URL of the image
* type: string
* format: uri * format: uri
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+27 -15
View File
@@ -96,18 +96,24 @@ export class ClaimItem extends SoftDeletableEntity {
* type: object * type: object
* required: * required:
* - claim_order_id * - claim_order_id
* - created_at
* - deleted_at
* - id
* - item_id * - item_id
* - variant_id * - metadata
* - reason * - note
* - quantity * - quantity
* - reason
* - updated_at
* - variant_id
* properties: * properties:
* id: * id:
* type: string
* description: The claim item's ID * description: The claim item's ID
* type: string
* example: citm_01G8ZH853Y6TFXWPG5EYE81X63 * example: citm_01G8ZH853Y6TFXWPG5EYE81X63
* images: * images:
* type: array
* description: Available if the relation `images` is expanded. * description: Available if the relation `images` is expanded.
* type: array
* items: * items:
* $ref: "#/components/schemas/ClaimImage" * $ref: "#/components/schemas/ClaimImage"
* claim_order_id: * claim_order_id:
@@ -115,23 +121,26 @@ export class ClaimItem extends SoftDeletableEntity {
* type: string * type: string
* claim_order: * claim_order:
* description: A claim order object. Available if the relation `claim_order` is expanded. * description: A claim order object. Available if the relation `claim_order` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/ClaimOrder"
* item_id: * item_id:
* description: The ID of the line item that the claim item refers to. * description: The ID of the line item that the claim item refers to.
* type: string * type: string
* example: item_01G8ZM25TN49YV9EQBE2NC27KC * example: item_01G8ZM25TN49YV9EQBE2NC27KC
* item: * item:
* description: Available if the relation `item` is expanded. * description: Available if the relation `item` is expanded.
* nullable: true
* $ref: "#/components/schemas/LineItem" * $ref: "#/components/schemas/LineItem"
* variant_id: * variant_id:
* description: "The ID of the product variant that is claimed." * description: The ID of the product variant that is claimed.
* type: string * type: string
* example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 * example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
* variant: * variant:
* description: A variant object. Available if the relation `variant` is expanded. * description: A variant object. Available if the relation `variant` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/ProductVariant"
* reason: * reason:
* description: "The reason for the claim" * description: The reason for the claim
* type: string * type: string
* enum: * enum:
* - missing_item * - missing_item
@@ -139,32 +148,35 @@ export class ClaimItem extends SoftDeletableEntity {
* - production_failure * - production_failure
* - other * - other
* note: * note:
* description: "An optional note about the claim, for additional information" * description: An optional note about the claim, for additional information
* nullable: true
* type: string * type: string
* example: "I don't like it." * example: "I don't like it."
* quantity: * quantity:
* description: "The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order." * description: The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order.
* type: integer * type: integer
* example: 1 * example: 1
* tags: * tags:
* description: "User defined tags for easy filtering and grouping. Available if the relation 'tags' is expanded." * description: User defined tags for easy filtering and grouping. Available if the relation 'tags' is expanded.
* type: array * type: array
* items: * items:
* $ref: "#/components/schemas/ClaimTag" * $ref: "#/components/schemas/ClaimTag"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+44 -20
View File
@@ -136,27 +136,41 @@ export class ClaimOrder extends SoftDeletableEntity {
* description: "Claim Orders represent a group of faulty or missing items. Each claim order consists of a subset of items associated with an original order, and can contain additional information about fulfillments and returns." * description: "Claim Orders represent a group of faulty or missing items. Each claim order consists of a subset of items associated with an original order, and can contain additional information about fulfillments and returns."
* type: object * type: object
* required: * required:
* - type * - canceled_at
* - created_at
* - deleted_at
* - fulfillment_status
* - id
* - idempotency_key
* - metadata
* - no_notification
* - order_id * - order_id
* - payment_status
* - refund_amount
* - shipping_address_id
* - type
* - updated_at
* properties: * properties:
* id: * id:
* type: string
* description: The claim's ID * description: The claim's ID
* type: string
* example: claim_01G8ZH853Y6TFXWPG5EYE81X63 * example: claim_01G8ZH853Y6TFXWPG5EYE81X63
* type: * type:
* description: The claim's type
* type: string * type: string
* enum: * enum:
* - refund * - refund
* - replace * - replace
* payment_status: * payment_status:
* type: string
* description: The status of the claim's payment * description: The status of the claim's payment
* type: string
* enum: * enum:
* - na * - na
* - not_refunded * - not_refunded
* - refunded * - refunded
* default: na * default: na
* fulfillment_status: * fulfillment_status:
* description: The claim's fulfillment status
* type: string * type: string
* enum: * enum:
* - not_fulfilled * - not_fulfilled
@@ -170,73 +184,83 @@ export class ClaimOrder extends SoftDeletableEntity {
* - requires_action * - requires_action
* default: not_fulfilled * default: not_fulfilled
* claim_items: * claim_items:
* description: "The items that have been claimed" * description: The items that have been claimed
* type: array * type: array
* items: * items:
* $ref: "#/components/schemas/ClaimItem" * $ref: "#/components/schemas/ClaimItem"
* additional_items: * additional_items:
* description: "Refers to the new items to be shipped when the claim order has the type `replace`" * description: Refers to the new items to be shipped when the claim order has the type `replace`
* type: array * type: array
* items: * items:
* $ref: "#/components/schemas/LineItem" * $ref: "#/components/schemas/LineItem"
* order_id: * order_id:
* description: "The ID of the order that the claim comes from." * description: The ID of the order that the claim comes from.
* type: string * type: string
* example: order_01G8TJSYT9M6AVS5N4EMNFS1EK * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
* order: * order:
* description: An order object. Available if the relation `order` is expanded. * description: An order object. Available if the relation `order` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Order"
* return_order: * return_order:
* description: "A return object. Holds information about the return if the claim is to be returned. Available if the relation 'return_order' is expanded" * description: A return object. Holds information about the return if the claim is to be returned. Available if the relation 'return_order' is expanded
* type: object * nullable: true
* $ref: "#/components/schemas/Return"
* shipping_address_id: * shipping_address_id:
* description: "The ID of the address that the new items should be shipped to" * description: The ID of the address that the new items should be shipped to
* nullable: true
* type: string * type: string
* example: addr_01G8ZH853YPY9B94857DY91YGW * example: addr_01G8ZH853YPY9B94857DY91YGW
* shipping_address: * shipping_address:
* description: Available if the relation `shipping_address` is expanded. * description: Available if the relation `shipping_address` is expanded.
* nullable: true
* $ref: "#/components/schemas/Address" * $ref: "#/components/schemas/Address"
* shipping_methods: * shipping_methods:
* description: "The shipping methods that the claim order will be shipped with." * description: The shipping methods that the claim order will be shipped with.
* type: array * type: array
* items: * items:
* $ref: "#/components/schemas/ShippingMethod" * $ref: "#/components/schemas/ShippingMethod"
* fulfillments: * fulfillments:
* description: "The fulfillments of the new items to be shipped" * description: The fulfillments of the new items to be shipped
* type: array * type: array
* items: * items:
* $ref: "#/components/schemas/Fulfillment" * $ref: "#/components/schemas/Fulfillment"
* refund_amount: * refund_amount:
* description: "The amount that will be refunded in conjunction with the claim" * description: The amount that will be refunded in conjunction with the claim
* nullable: true
* type: integer * type: integer
* example: 1000 * example: 1000
* canceled_at: * canceled_at:
* description: "The date with timezone at which the claim was canceled." * description: The date with timezone at which the claim was canceled.
* nullable: true
* type: string * type: string
* format: date-time * format: date-time
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
* no_notification: * no_notification:
* description: "Flag for describing whether or not notifications related to this should be send." * description: Flag for describing whether or not notifications related to this should be send.
* nullable: true
* type: boolean * type: boolean
* example: false * example: false
* idempotency_key: * idempotency_key:
* type: string
* description: Randomly generated key used to continue the completion of the cart associated with the claim in case of failure. * description: Randomly generated key used to continue the completion of the cart associated with the claim in case of failure.
* nullable: true
* type: string
* externalDocs: * externalDocs:
* url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
* description: Learn more how to use the idempotency key. * description: Learn more how to use the idempotency key.
+13 -6
View File
@@ -25,30 +25,37 @@ export class ClaimTag extends SoftDeletableEntity {
* description: "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping." * description: "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping."
* type: object * type: object
* required: * required:
* - created_at
* - deleted_at
* - id
* - metadata
* - updated_at
* - value * - value
* properties: * properties:
* id: * id:
* type: string
* description: The claim tag's ID * description: The claim tag's ID
* type: string
* example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 * example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4
* value: * value:
* description: "The value that the claim tag holds" * description: The value that the claim tag holds
* type: string * type: string
* example: Damaged * example: Damaged
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+14 -10
View File
@@ -45,50 +45,54 @@ export class Country {
* description: "Country details" * description: "Country details"
* type: object * type: object
* required: * required:
* - display_name
* - id
* - iso_2 * - iso_2
* - iso_3 * - iso_3
* - num_code
* - name * - name
* - display_name * - num_code
* - region_id
* properties: * properties:
* id: * id:
* type: string
* description: The country's ID * description: The country's ID
* type: string
* example: 109 * example: 109
* iso_2: * iso_2:
* type: string
* description: The 2 character ISO code of the country in lower case * description: The 2 character ISO code of the country in lower case
* type: string
* example: it * example: it
* externalDocs: * externalDocs:
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
* description: See a list of codes. * description: See a list of codes.
* iso_3: * iso_3:
* type: string
* description: The 2 character ISO code of the country in lower case * description: The 2 character ISO code of the country in lower case
* type: string
* example: ita * example: ita
* externalDocs: * externalDocs:
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements
* description: See a list of codes. * description: See a list of codes.
* num_code: * num_code:
* description: "The numerical ISO code for the country." * description: The numerical ISO code for the country.
* type: string * type: string
* example: 380 * example: 380
* externalDocs: * externalDocs:
* url: https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements * url: https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements
* description: See a list of codes. * description: See a list of codes.
* name: * name:
* description: "The normalized country name in upper case." * description: The normalized country name in upper case.
* type: string * type: string
* example: ITALY * example: ITALY
* display_name: * display_name:
* description: "The country name appropriate for display." * description: The country name appropriate for display.
* type: string * type: string
* example: Italy * example: Italy
* region_id: * region_id:
* type: string
* description: The region ID this country is associated with. * description: The region ID this country is associated with.
* nullable: true
* type: string
* example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
* region: * region:
* description: A region object. Available if the relation `region` is expanded. * description: A region object. Available if the relation `region` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Region"
*/ */
+6 -5
View File
@@ -27,30 +27,31 @@ export class Currency {
* type: object * type: object
* required: * required:
* - code * - code
* - name
* - symbol * - symbol
* - symbol_native * - symbol_native
* - name
* properties: * properties:
* code: * code:
* description: "The 3 character ISO code for the currency." * description: The 3 character ISO code for the currency.
* type: string * type: string
* example: usd * example: usd
* externalDocs: * externalDocs:
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
* description: See a list of codes. * description: See a list of codes.
* symbol: * symbol:
* description: "The symbol used to indicate the currency." * description: The symbol used to indicate the currency.
* type: string * type: string
* example: $ * example: $
* symbol_native: * symbol_native:
* description: "The native symbol used to indicate the currency." * description: The native symbol used to indicate the currency.
* type: string * type: string
* example: $ * example: $
* name: * name:
* description: "The written name of the currency" * description: The written name of the currency
* type: string * type: string
* example: US Dollar * example: US Dollar
* includes_tax: * includes_tax:
* description: "[EXPERIMENTAL] Does the currency prices include tax" * description: "[EXPERIMENTAL] Does the currency prices include tax"
* type: boolean * type: boolean
* default: false
*/ */
@@ -51,48 +51,56 @@ export class CustomShippingOption extends SoftDeletableEntity {
* description: "Custom Shipping Options are 'overriden' Shipping Options. Store managers can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option" * description: "Custom Shipping Options are 'overriden' Shipping Options. Store managers can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option"
* type: object * type: object
* required: * required:
* - cart_id
* - created_at
* - deleted_at
* - id
* - metadata
* - price * - price
* - shipping_option_id * - shipping_option_id
* - updated_at
* properties: * properties:
* id: * id:
* type: string
* description: The custom shipping option's ID * description: The custom shipping option's ID
* type: string
* example: cso_01G8X99XNB77DMFBJFWX6DN9V9 * example: cso_01G8X99XNB77DMFBJFWX6DN9V9
* price: * price:
* description: "The custom price set that will override the shipping option's original price" * description: The custom price set that will override the shipping option's original price
* type: integer * type: integer
* example: 1000 * example: 1000
* shipping_option_id: * shipping_option_id:
* description: "The ID of the Shipping Option that the custom shipping option overrides" * description: The ID of the Shipping Option that the custom shipping option overrides
* type: string * type: string
* example: so_01G1G5V27GYX4QXNARRQCW1N8T * example: so_01G1G5V27GYX4QXNARRQCW1N8T
* shipping_option: * shipping_option:
* description: A shipping option object. Available if the relation `shipping_option` is expanded. * description: A shipping option object. Available if the relation `shipping_option` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/ShippingOption"
* cart_id: * cart_id:
* description: "The ID of the Cart that the custom shipping option is attached to" * description: The ID of the Cart that the custom shipping option is attached to
* nullable: true
* type: string * type: string
* example: cart_01G8ZH853Y6TFXWPG5EYE81X63 * example: cart_01G8ZH853Y6TFXWPG5EYE81X63
* cart: * cart:
* description: A cart object. Available if the relation `cart` is expanded. * description: A cart object. Available if the relation `cart` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Cart"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
* includes_tax:
* description: "[EXPERIMENTAL] Indicates if the custom shipping option price include tax"
* type: boolean
*/ */
+17 -11
View File
@@ -37,41 +37,47 @@ export class CustomerGroup extends SoftDeletableEntity {
* description: "Represents a customer group" * description: "Represents a customer group"
* type: object * type: object
* required: * required:
* - created_at
* - deleted_at
* - id
* - metadata
* - name * - name
* - updated_at
* properties: * properties:
* id: * id:
* type: string
* description: The customer group's ID * description: The customer group's ID
* type: string
* example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 * example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63
* name: * name:
* type: string
* description: The name of the customer group * description: The name of the customer group
* type: string
* example: VIP * example: VIP
* customers: * customers:
* type: array
* description: The customers that belong to the customer group. Available if the relation `customers` is expanded. * description: The customers that belong to the customer group. Available if the relation `customers` is expanded.
* items:
* type: object
* description: A customer object.
* price_lists:
* type: array * type: array
* items:
* $ref: "#/components/schemas/Customer"
* price_lists:
* description: The price lists that are associated with the customer group. Available if the relation `price_lists` is expanded. * description: The price lists that are associated with the customer group. Available if the relation `price_lists` is expanded.
* type: array
* items: * items:
* $ref: "#/components/schemas/PriceList" * $ref: "#/components/schemas/PriceList"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+29 -13
View File
@@ -85,30 +85,44 @@ export class Customer extends SoftDeletableEntity {
* description: "Represents a customer" * description: "Represents a customer"
* type: object * type: object
* required: * required:
* - billing_address_id
* - created_at
* - deleted_at
* - email * - email
* - first_name
* - has_account
* - id
* - last_name
* - metadata
* - phone
* - updated_at
* properties: * properties:
* id: * id:
* type: string
* description: The customer's ID * description: The customer's ID
* type: string
* example: cus_01G2SG30J8C85S4A5CHM2S1NS2 * example: cus_01G2SG30J8C85S4A5CHM2S1NS2
* email: * email:
* type: string
* description: The customer's email * description: The customer's email
* type: string
* format: email * format: email
* first_name: * first_name:
* type: string
* description: The customer's first name * description: The customer's first name
* nullable: true
* type: string
* example: Arno * example: Arno
* last_name: * last_name:
* type: string
* description: The customer's last name * description: The customer's last name
* nullable: true
* type: string
* example: Willms * example: Willms
* billing_address_id: * billing_address_id:
* type: string
* description: The customer's billing address ID * description: The customer's billing address ID
* nullable: true
* type: string
* example: addr_01G8ZH853YPY9B94857DY91YGW * example: addr_01G8ZH853YPY9B94857DY91YGW
* billing_address: * billing_address:
* description: Available if the relation `billing_address` is expanded. * description: Available if the relation `billing_address` is expanded.
* nullable: true
* $ref: "#/components/schemas/Address" * $ref: "#/components/schemas/Address"
* shipping_addresses: * shipping_addresses:
* description: Available if the relation `shipping_addresses` is expanded. * description: Available if the relation `shipping_addresses` is expanded.
@@ -116,38 +130,40 @@ export class Customer extends SoftDeletableEntity {
* items: * items:
* $ref: "#/components/schemas/Address" * $ref: "#/components/schemas/Address"
* phone: * phone:
* type: string
* description: The customer's phone number * description: The customer's phone number
* nullable: true
* type: string
* example: 16128234334802 * example: 16128234334802
* has_account: * has_account:
* type: boolean
* description: Whether the customer has an account or not * description: Whether the customer has an account or not
* type: boolean
* default: false * default: false
* orders: * orders:
* description: Available if the relation `orders` is expanded. * description: Available if the relation `orders` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/Order"
* description: An order object.
* groups: * groups:
* description: The customer groups the customer belongs to. Available if the relation `groups` is expanded. * description: The customer groups the customer belongs to. Available if the relation `groups` is expanded.
* type: array * type: array
* items: * items:
* $ref: "#/components/schemas/CustomerGroup" * $ref: "#/components/schemas/CustomerGroup"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
@@ -43,33 +43,39 @@ export class DiscountConditionCustomerGroup {
* description: "Associates a discount condition with a customer group" * description: "Associates a discount condition with a customer group"
* type: object * type: object
* required: * required:
* - customer_group_id
* - condition_id * - condition_id
* - created_at
* - customer_group_id
* - metadata
* - updated_at
* properties: * properties:
* customer_group_id: * customer_group_id:
* description: "The ID of the Product Tag" * description: The ID of the Product Tag
* type: string * type: string
* example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 * example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63
* condition_id: * condition_id:
* description: "The ID of the Discount Condition" * description: The ID of the Discount Condition
* type: string * type: string
* example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
* customer_group: * customer_group:
* description: Available if the relation `customer_group` is expanded. * description: Available if the relation `customer_group` is expanded.
* nullable: true
* $ref: "#/components/schemas/CustomerGroup" * $ref: "#/components/schemas/CustomerGroup"
* discount_condition: * discount_condition:
* description: Available if the relation `discount_condition` is expanded. * description: Available if the relation `discount_condition` is expanded.
* nullable: true
* $ref: "#/components/schemas/DiscountCondition" * $ref: "#/components/schemas/DiscountCondition"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
@@ -43,33 +43,39 @@ export class DiscountConditionProductCollection {
* description: "Associates a discount condition with a product collection" * description: "Associates a discount condition with a product collection"
* type: object * type: object
* required: * required:
* - product_collection_id
* - condition_id * - condition_id
* - created_at
* - metadata
* - product_collection_id
* - updated_at
* properties: * properties:
* product_collection_id: * product_collection_id:
* description: "The ID of the Product Collection" * description: The ID of the Product Collection
* type: string * type: string
* example: pcol_01F0YESBFAZ0DV6V831JXWH0BG * example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
* condition_id: * condition_id:
* description: "The ID of the Discount Condition" * description: The ID of the Discount Condition
* type: string * type: string
* example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
* product_collection: * product_collection:
* description: Available if the relation `product_collection` is expanded. * description: Available if the relation `product_collection` is expanded.
* nullable: true
* $ref: "#/components/schemas/ProductCollection" * $ref: "#/components/schemas/ProductCollection"
* discount_condition: * discount_condition:
* description: Available if the relation `discount_condition` is expanded. * description: Available if the relation `discount_condition` is expanded.
* nullable: true
* $ref: "#/components/schemas/DiscountCondition" * $ref: "#/components/schemas/DiscountCondition"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
@@ -43,33 +43,39 @@ export class DiscountConditionProductTag {
* description: "Associates a discount condition with a product tag" * description: "Associates a discount condition with a product tag"
* type: object * type: object
* required: * required:
* - product_tag_id
* - condition_id * - condition_id
* - created_at
* - metadata
* - product_tag_id
* - updated_at
* properties: * properties:
* product_tag_id: * product_tag_id:
* description: "The ID of the Product Tag" * description: The ID of the Product Tag
* type: string * type: string
* example: ptag_01F0YESHPZYY3H4SJ3A5918SBN * example: ptag_01F0YESHPZYY3H4SJ3A5918SBN
* condition_id: * condition_id:
* description: "The ID of the Discount Condition" * description: The ID of the Discount Condition
* type: string * type: string
* example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
* product_tag: * product_tag:
* description: Available if the relation `product_tag` is expanded. * description: Available if the relation `product_tag` is expanded.
* nullable: true
* $ref: "#/components/schemas/ProductTag" * $ref: "#/components/schemas/ProductTag"
* discount_condition: * discount_condition:
* description: Available if the relation `discount_condition` is expanded. * description: Available if the relation `discount_condition` is expanded.
* nullable: true
* $ref: "#/components/schemas/DiscountCondition" * $ref: "#/components/schemas/DiscountCondition"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
@@ -43,33 +43,39 @@ export class DiscountConditionProductType {
* description: "Associates a discount condition with a product type" * description: "Associates a discount condition with a product type"
* type: object * type: object
* required: * required:
* - product_type_id
* - condition_id * - condition_id
* - created_at
* - metadata
* - product_type_id
* - updated_at
* properties: * properties:
* product_type_id: * product_type_id:
* description: "The ID of the Product Tag" * description: The ID of the Product Tag
* type: string * type: string
* example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A * example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
* condition_id: * condition_id:
* description: "The ID of the Discount Condition" * description: The ID of the Discount Condition
* type: string * type: string
* example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
* product_type: * product_type:
* description: Available if the relation `product_type` is expanded. * description: Available if the relation `product_type` is expanded.
* nullable: true
* $ref: "#/components/schemas/ProductType" * $ref: "#/components/schemas/ProductType"
* discount_condition: * discount_condition:
* description: Available if the relation `discount_condition` is expanded. * description: Available if the relation `discount_condition` is expanded.
* nullable: true
* $ref: "#/components/schemas/DiscountCondition" * $ref: "#/components/schemas/DiscountCondition"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
@@ -43,33 +43,39 @@ export class DiscountConditionProduct {
* description: "Associates a discount condition with a product" * description: "Associates a discount condition with a product"
* type: object * type: object
* required: * required:
* - product_id
* - condition_id * - condition_id
* - created_at
* - metadata
* - product_id
* - updated_at
* properties: * properties:
* product_id: * product_id:
* description: "The ID of the Product Tag" * description: The ID of the Product Tag
* type: string * type: string
* example: prod_01G1G5V2MBA328390B5AXJ610F * example: prod_01G1G5V2MBA328390B5AXJ610F
* condition_id: * condition_id:
* description: "The ID of the Discount Condition" * description: The ID of the Discount Condition
* type: string * type: string
* example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
* product: * product:
* description: Available if the relation `product` is expanded. * description: Available if the relation `product` is expanded.
* nullable: true
* $ref: "#/components/schemas/Product" * $ref: "#/components/schemas/Product"
* discount_condition: * discount_condition:
* description: Available if the relation `discount_condition` is expanded. * description: Available if the relation `discount_condition` is expanded.
* nullable: true
* $ref: "#/components/schemas/DiscountCondition" * $ref: "#/components/schemas/DiscountCondition"
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
@@ -141,13 +141,18 @@ export class DiscountCondition extends SoftDeletableEntity {
* description: "Holds rule conditions for when a discount is applicable" * description: "Holds rule conditions for when a discount is applicable"
* type: object * type: object
* required: * required:
* - type * - created_at
* - operator * - deleted_at
* - discount_rule_id * - discount_rule_id
* - id
* - metadata
* - operator
* - type
* - updated_at
* properties: * properties:
* id: * id:
* type: string
* description: The discount condition's ID * description: The discount condition's ID
* type: string
* example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
* type: * type:
* description: "The type of the Condition" * description: "The type of the Condition"
@@ -165,56 +170,54 @@ export class DiscountCondition extends SoftDeletableEntity {
* - in * - in
* - not_in * - not_in
* discount_rule_id: * discount_rule_id:
* type: string
* description: The ID of the discount rule associated with the condition * description: The ID of the discount rule associated with the condition
* type: string
* example: dru_01F0YESMVK96HVX7N419E3CJ7C * example: dru_01F0YESMVK96HVX7N419E3CJ7C
* discount_rule: * discount_rule:
* description: Available if the relation `discount_rule` is expanded. * description: Available if the relation `discount_rule` is expanded.
* nullable: true
* $ref: "#/components/schemas/DiscountRule" * $ref: "#/components/schemas/DiscountRule"
* products: * products:
* description: products associated with this condition if type = products. Available if the relation `products` is expanded. * description: products associated with this condition if type = products. Available if the relation `products` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/Product"
* description: A product object.
* product_types: * product_types:
* description: product types associated with this condition if type = product_types. Available if the relation `product_types` is expanded. * description: Product types associated with this condition if type = product_types. Available if the relation `product_types` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/ProductType"
* description: A product type object.
* product_tags: * product_tags:
* description: product tags associated with this condition if type = product_tags. Available if the relation `product_tags` is expanded. * description: Product tags associated with this condition if type = product_tags. Available if the relation `product_tags` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/ProductTag"
* description: A product tag object.
* product_collections: * product_collections:
* description: product collections associated with this condition if type = product_collections. Available if the relation `product_collections` is expanded. * description: Product collections associated with this condition if type = product_collections. Available if the relation `product_collections` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/ProductCollection"
* description: A product collection object.
* customer_groups: * customer_groups:
* description: customer groups associated with this condition if type = customer_groups. Available if the relation `customer_groups` is expanded. * description: Customer groups associated with this condition if type = customer_groups. Available if the relation `customer_groups` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/CustomerGroup"
* description: A customer group object.
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+21 -11
View File
@@ -55,15 +55,22 @@ export class DiscountRule extends SoftDeletableEntity {
* description: "Holds the rules that governs how a Discount is calculated when applied to a Cart." * description: "Holds the rules that governs how a Discount is calculated when applied to a Cart."
* type: object * type: object
* required: * required:
* - allocation
* - created_at
* - deleted_at
* - description
* - id
* - metadata
* - type * - type
* - updated_at
* - value * - value
* properties: * properties:
* id: * id:
* type: string
* description: The discount rule's ID * description: The discount rule's ID
* type: string
* example: dru_01F0YESMVK96HVX7N419E3CJ7C * example: dru_01F0YESMVK96HVX7N419E3CJ7C
* type: * type:
* description: "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers." * description: The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers.
* type: string * type: string
* enum: * enum:
* - fixed * - fixed
@@ -71,15 +78,17 @@ export class DiscountRule extends SoftDeletableEntity {
* - free_shipping * - free_shipping
* example: percentage * example: percentage
* description: * description:
* description: "A short description of the discount" * description: A short description of the discount
* nullable: true
* type: string * type: string
* example: 10 Percent * example: 10 Percent
* value: * value:
* description: "The value that the discount represents; this will depend on the type of the discount" * description: The value that the discount represents; this will depend on the type of the discount
* type: integer * type: integer
* example: 10 * example: 10
* allocation: * allocation:
* description: "The scope that the discount should apply to." * description: The scope that the discount should apply to.
* nullable: true
* type: string * type: string
* enum: * enum:
* - total * - total
@@ -89,22 +98,23 @@ export class DiscountRule extends SoftDeletableEntity {
* description: A set of conditions that can be used to limit when the discount can be used. Available if the relation `conditions` is expanded. * description: A set of conditions that can be used to limit when the discount can be used. Available if the relation `conditions` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/DiscountCondition"
* description: A discount condition object.
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+38 -17
View File
@@ -95,79 +95,100 @@ export class Discount extends SoftDeletableEntity {
* type: object * type: object
* required: * required:
* - code * - code
* - created_at
* - deleted_at
* - ends_at
* - id
* - is_disabled
* - is_dynamic * - is_dynamic
* - metadata
* - parent_discount_id
* - rule_id
* - starts_at
* - updated_at
* - usage_count
* - usage_limit
* - valid_duration
* properties: * properties:
* id: * id:
* type: string
* description: The discount's ID * description: The discount's ID
* type: string
* example: disc_01F0YESMW10MGHWJKZSDDMN0VN * example: disc_01F0YESMW10MGHWJKZSDDMN0VN
* code: * code:
* description: "A unique code for the discount - this will be used by the customer to apply the discount" * description: A unique code for the discount - this will be used by the customer to apply the discount
* type: string * type: string
* example: 10DISC * example: 10DISC
* is_dynamic: * is_dynamic:
* description: "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts" * description: A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts
* type: boolean * type: boolean
* example: false * example: false
* rule_id: * rule_id:
* description: The Discount Rule that governs the behaviour of the Discount
* nullable: true
* type: string * type: string
* description: "The Discount Rule that governs the behaviour of the Discount"
* example: dru_01F0YESMVK96HVX7N419E3CJ7C * example: dru_01F0YESMVK96HVX7N419E3CJ7C
* rule: * rule:
* description: Available if the relation `rule` is expanded. * description: Available if the relation `rule` is expanded.
* nullable: true
* $ref: "#/components/schemas/DiscountRule" * $ref: "#/components/schemas/DiscountRule"
* is_disabled: * is_disabled:
* description: "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts" * description: Whether the Discount has been disabled. Disabled discounts cannot be applied to carts
* type: boolean * type: boolean
* example: false * example: false
* parent_discount_id: * parent_discount_id:
* description: The Discount that the discount was created from. This will always be a dynamic discount
* nullable: true
* type: string * type: string
* description: "The Discount that the discount was created from. This will always be a dynamic discount"
* example: disc_01G8ZH853YPY9B94857DY91YGW * example: disc_01G8ZH853YPY9B94857DY91YGW
* parent_discount: * parent_discount:
* description: Available if the relation `parent_discount` is expanded. * description: Available if the relation `parent_discount` is expanded.
* nullable: true
* $ref: "#/components/schemas/Discount" * $ref: "#/components/schemas/Discount"
* starts_at: * starts_at:
* description: "The time at which the discount can be used." * description: The time at which the discount can be used.
* type: string * type: string
* format: date-time * format: date-time
* ends_at: * ends_at:
* description: "The time at which the discount can no longer be used." * description: The time at which the discount can no longer be used.
* nullable: true
* type: string * type: string
* format: date-time * format: date-time
* valid_duration: * valid_duration:
* type: string
* description: Duration the discount runs between * description: Duration the discount runs between
* nullable: true
* type: string
* example: P3Y6M4DT12H30M5S * example: P3Y6M4DT12H30M5S
* regions: * regions:
* description: The Regions in which the Discount can be used. Available if the relation `regions` is expanded. * description: The Regions in which the Discount can be used. Available if the relation `regions` is expanded.
* type: array * type: array
* items: * items:
* type: object * $ref: "#/components/schemas/Region"
* description: A region object.
* usage_limit: * usage_limit:
* description: "The maximum number of times that a discount can be used." * description: The maximum number of times that a discount can be used.
* nullable: true
* type: integer * type: integer
* example: 100 * example: 100
* usage_count: * usage_count:
* description: "The number of times a discount has been used." * description: The number of times a discount has been used.
* type: integer * type: integer
* example: 50 * example: 50
* default: 0 * default: 0
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time * format: date-time
* deleted_at: * deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string * type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */
+36 -18
View File
@@ -84,68 +84,86 @@ export class DraftOrder extends BaseEntity {
* title: "DraftOrder" * title: "DraftOrder"
* description: "Represents a draft order" * description: "Represents a draft order"
* type: object * type: object
* required:
* - canceled_at
* - cart_id
* - completed_at
* - created_at
* - display_id
* - id
* - idempotency_key
* - metadata
* - no_notification_order
* - order_id
* - status
* - updated_at
* properties: * properties:
* id: * id:
* type: string
* description: The draft order's ID * description: The draft order's ID
* type: string
* example: dorder_01G8TJFKBG38YYFQ035MSVG03C * example: dorder_01G8TJFKBG38YYFQ035MSVG03C
* status: * status:
* type: string
* description: The status of the draft order * description: The status of the draft order
* type: string
* enum: * enum:
* - open * - open
* - completed * - completed
* default: open * default: open
* display_id: * display_id:
* type: string
* description: The draft order's display ID * description: The draft order's display ID
* type: string
* example: 2 * example: 2
* cart_id: * cart_id:
* description: The ID of the cart associated with the draft order.
* nullable: true
* type: string * type: string
* description: "The ID of the cart associated with the draft order."
* example: cart_01G8ZH853Y6TFXWPG5EYE81X63 * example: cart_01G8ZH853Y6TFXWPG5EYE81X63
* cart: * cart:
* description: A cart object. Available if the relation `cart` is expanded. * description: A cart object. Available if the relation `cart` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Cart"
* order_id: * order_id:
* description: The ID of the order associated with the draft order.
* nullable: true
* type: string * type: string
* description: "The ID of the order associated with the draft order."
* example: order_01G8TJSYT9M6AVS5N4EMNFS1EK * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
* order: * order:
* description: An order object. Available if the relation `order` is expanded. * description: An order object. Available if the relation `order` is expanded.
* type: object * nullable: true
* $ref: "#/components/schemas/Order"
* canceled_at: * canceled_at:
* type: string
* description: The date the draft order was canceled at. * description: The date the draft order was canceled at.
* nullable: true
* type: string
* format: date-time * format: date-time
* completed_at: * completed_at:
* type: string
* description: The date the draft order was completed at. * description: The date the draft order was completed at.
* nullable: true
* type: string
* format: date-time * format: date-time
* no_notification_order: * no_notification_order:
* type: boolean
* description: Whether to send the customer notifications regarding order updates. * description: Whether to send the customer notifications regarding order updates.
* nullable: true
* type: boolean
* example: false * example: false
* idempotency_key: * idempotency_key:
* type: string
* description: Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure. * description: Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure.
* nullable: true
* type: string
* externalDocs: * externalDocs:
* url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
* description: Learn more how to use the idempotency key. * description: Learn more how to use the idempotency key.
* created_at: * created_at:
* description: The date with timezone at which the resource was created.
* type: string * type: string
* description: "The date with timezone at which the resource was created."
* format: date-time * format: date-time
* updated_at: * updated_at:
* description: The date with timezone at which the resource was updated.
* type: string * type: string
* description: "The date with timezone at which the resource was updated."
* format: date-time
* deleted_at:
* type: string
* description: "The date with timezone at which the resource was deleted."
* format: date-time * format: date-time
* metadata: * metadata:
* type: object
* description: An optional key-value map with additional details * description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"} * example: {car: "white"}
*/ */