feat(oas) - accurate model OAS representation - PA to PU (#3223)
### Scope
Models PA to PU
### 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:
5
.changeset/short-jeans-develop.md
Normal file
5
.changeset/short-jeans-develop.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
feat(oas) - accurate model OAS representation - PA to PU
|
||||
@@ -105,25 +105,32 @@ export class PaymentCollection extends SoftDeletableEntity {
|
||||
* description: "Payment Collection"
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - status
|
||||
* - amount
|
||||
* - region_id
|
||||
* - currency_code
|
||||
* - authorized_amount
|
||||
* - created_at
|
||||
* - created_by
|
||||
* - currency_code
|
||||
* - deleted_at
|
||||
* - description
|
||||
* - id
|
||||
* - metadata
|
||||
* - region_id
|
||||
* - status
|
||||
* - type
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The payment collection's ID
|
||||
* type: string
|
||||
* example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
|
||||
* type:
|
||||
* type: string
|
||||
* description: The type of the payment collection
|
||||
* type: string
|
||||
* enum:
|
||||
* - order_edit
|
||||
* status:
|
||||
* type: string
|
||||
* description: The type of the payment collection
|
||||
* type: string
|
||||
* enum:
|
||||
* - not_paid
|
||||
* - awaiting
|
||||
@@ -131,23 +138,26 @@ export class PaymentCollection extends SoftDeletableEntity {
|
||||
* - partially_authorized
|
||||
* - canceled
|
||||
* description:
|
||||
* type: string
|
||||
* description: Description of the payment collection
|
||||
* amount:
|
||||
* type: number
|
||||
* description: Amount of the payment collection.
|
||||
* authorized_amount:
|
||||
* type: number
|
||||
* description: Authorized amount of the payment collection.
|
||||
* region_id:
|
||||
* nullable: true
|
||||
* type: string
|
||||
* amount:
|
||||
* description: Amount of the payment collection.
|
||||
* type: integer
|
||||
* authorized_amount:
|
||||
* description: Authorized amount of the payment collection.
|
||||
* nullable: true
|
||||
* type: integer
|
||||
* region_id:
|
||||
* description: The region's ID
|
||||
* type: string
|
||||
* example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
|
||||
* region:
|
||||
* description: Available if the relation `region` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Region"
|
||||
* currency_code:
|
||||
* description: "The 3 character ISO code for the currency."
|
||||
* description: The 3 character ISO code for the currency.
|
||||
* type: string
|
||||
* example: usd
|
||||
* externalDocs:
|
||||
@@ -155,34 +165,37 @@ export class PaymentCollection extends SoftDeletableEntity {
|
||||
* description: See a list of codes.
|
||||
* currency:
|
||||
* description: Available if the relation `currency` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Currency"
|
||||
* payment_sessions:
|
||||
* type: array
|
||||
* description: Available if the relation `payment_sessions` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/PaymentSession"
|
||||
* payments:
|
||||
* type: array
|
||||
* description: Available if the relation `payments` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/Payment"
|
||||
* created_by:
|
||||
* description: The ID of the user that created the payment collection.
|
||||
* type: string
|
||||
* description: "The ID of the user that created the payment collection."
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -16,13 +16,14 @@ export class PaymentProvider {
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* - is_installed
|
||||
* properties:
|
||||
* id:
|
||||
* description: "The id of the payment provider as given by the plugin."
|
||||
* description: The id of the payment provider as given by the plugin.
|
||||
* type: string
|
||||
* example: manual
|
||||
* is_installed:
|
||||
* description: "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`."
|
||||
* description: Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.
|
||||
* type: boolean
|
||||
* default: true
|
||||
*/
|
||||
|
||||
@@ -73,36 +73,48 @@ export class PaymentSession extends BaseEntity {
|
||||
* description: "Payment Sessions are created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, who is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc."
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - cart_id
|
||||
* - created_at
|
||||
* - data
|
||||
* - id
|
||||
* - is_initiated
|
||||
* - is_selected
|
||||
* - idempotency_key
|
||||
* - payment_authorized_at
|
||||
* - provider_id
|
||||
* - status
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The payment session's ID
|
||||
* type: string
|
||||
* example: ps_01G901XNSRM2YS3ASN9H5KG3FZ
|
||||
* cart_id:
|
||||
* description: "The id of the Cart that the Payment Session is created for."
|
||||
* description: The id of the Cart that the Payment Session is created for.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: cart_01G8ZH853Y6TFXWPG5EYE81X63
|
||||
* cart:
|
||||
* description: A cart object. Available if the relation `cart` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Cart"
|
||||
* provider_id:
|
||||
* description: "The id of the Payment Provider that is responsible for the Payment Session"
|
||||
* description: The id of the Payment Provider that is responsible for the Payment Session
|
||||
* type: string
|
||||
* example: manual
|
||||
* is_selected:
|
||||
* description: "A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase."
|
||||
* description: A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase.
|
||||
* nullable: true
|
||||
* type: boolean
|
||||
* example: true
|
||||
* is_initiated:
|
||||
* description: "A flag to indicate if a communication with the third party provider has been initiated."
|
||||
* description: A flag to indicate if a communication with the third party provider has been initiated.
|
||||
* type: boolean
|
||||
* example: true
|
||||
* default: false
|
||||
* example: true
|
||||
* status:
|
||||
* description: "Indicates the status of the Payment Session. Will default to `pending`, and will eventually become `authorized`. Payment Sessions may have the status of `requires_more` to indicate that further actions are to be completed by the Customer."
|
||||
* description: Indicates the status of the Payment Session. Will default to `pending`, and will eventually become `authorized`. Payment Sessions may have the status of `requires_more` to indicate that further actions are to be completed by the Customer.
|
||||
* type: string
|
||||
* enum:
|
||||
* - authorized
|
||||
@@ -112,21 +124,32 @@ export class PaymentSession extends BaseEntity {
|
||||
* - canceled
|
||||
* example: pending
|
||||
* data:
|
||||
* description: "The data required for the Payment Provider to identify, modify and process the Payment Session. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state."
|
||||
* description: The data required for the Payment Provider to identify, modify and process the Payment Session. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.
|
||||
* type: object
|
||||
* example: {}
|
||||
* idempotency_key:
|
||||
* type: string
|
||||
* description: Randomly generated key used to continue the completion of a cart in case of failure.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
|
||||
* description: Learn more how to use the idempotency key.
|
||||
* created_at:
|
||||
* amount:
|
||||
* description: The amount that the Payment Session has been authorized for.
|
||||
* nullable: true
|
||||
* type: integer
|
||||
* example: 100
|
||||
* payment_authorized_at:
|
||||
* description: The date with timezone at which the Payment Session was authorized.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* format: date-time
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
*/
|
||||
|
||||
@@ -93,39 +93,57 @@ export class Payment extends BaseEntity {
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - amount_refunded
|
||||
* - canceled_at
|
||||
* - captured_at
|
||||
* - cart_id
|
||||
* - created_at
|
||||
* - currency_code
|
||||
* - data
|
||||
* - id
|
||||
* - idempotency_key
|
||||
* - metadata
|
||||
* - order_id
|
||||
* - provider_id
|
||||
* - swap_id
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The payment's ID
|
||||
* type: string
|
||||
* example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE
|
||||
* swap_id:
|
||||
* description: "The ID of the Swap that the Payment is used for."
|
||||
* description: The ID of the Swap that the Payment is used for.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* swap:
|
||||
* description: A swap object. Available if the relation `swap` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Swap"
|
||||
* cart_id:
|
||||
* description: "The id of the Cart that the Payment Session is created for."
|
||||
* description: The id of the Cart that the Payment Session is created for.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* cart:
|
||||
* description: A cart object. Available if the relation `cart` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Cart"
|
||||
* order_id:
|
||||
* description: "The ID of the Order that the Payment is used for."
|
||||
* description: The ID of the Order that the Payment is used for.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
|
||||
* order:
|
||||
* description: An order object. Available if the relation `order` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Order"
|
||||
* amount:
|
||||
* description: "The amount that the Payment has been authorized for."
|
||||
* description: The amount that the Payment has been authorized for.
|
||||
* type: integer
|
||||
* example: 100
|
||||
* currency_code:
|
||||
* description: "The 3 character ISO currency code that the Payment is completed in."
|
||||
* description: The 3 character ISO currency code that the Payment is completed in.
|
||||
* type: string
|
||||
* example: usd
|
||||
* externalDocs:
|
||||
@@ -133,43 +151,49 @@ export class Payment extends BaseEntity {
|
||||
* description: See a list of codes.
|
||||
* currency:
|
||||
* description: Available if the relation `currency` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Currency"
|
||||
* amount_refunded:
|
||||
* description: "The amount of the original Payment amount that has been refunded back to the Customer."
|
||||
* description: The amount of the original Payment amount that has been refunded back to the Customer.
|
||||
* type: integer
|
||||
* default: 0
|
||||
* example: 0
|
||||
* provider_id:
|
||||
* description: "The id of the Payment Provider that is responsible for the Payment"
|
||||
* description: The id of the Payment Provider that is responsible for the Payment
|
||||
* type: string
|
||||
* example: manual
|
||||
* data:
|
||||
* description: "The data required for the Payment Provider to identify, modify and process the Payment. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state."
|
||||
* description: The data required for the Payment Provider to identify, modify and process the Payment. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.
|
||||
* type: object
|
||||
* example: {}
|
||||
* captured_at:
|
||||
* description: "The date with timezone at which the Payment was captured."
|
||||
* description: The date with timezone at which the Payment was captured.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* format: date-time
|
||||
* canceled_at:
|
||||
* description: "The date with timezone at which the Payment was canceled."
|
||||
* description: The date with timezone at which the Payment was canceled.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* format: date-time
|
||||
* idempotency_key:
|
||||
* type: string
|
||||
* description: Randomly generated key used to continue the completion of a payment in case of failure.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
|
||||
* description: Learn more how to use the idempotency key.
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -75,69 +75,78 @@ export class PriceList extends SoftDeletableEntity {
|
||||
* description: "Price Lists represents a set of prices that overrides the default price for one or more product variants."
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - description
|
||||
* - ends_at
|
||||
* - id
|
||||
* - name
|
||||
* - starts_at
|
||||
* - status
|
||||
* - type
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The price list's ID
|
||||
* type: string
|
||||
* example: pl_01G8X3CKJXCG5VXVZ87H9KC09W
|
||||
* name:
|
||||
* type: string
|
||||
* description: The price list's name
|
||||
* type: string
|
||||
* example: VIP Prices
|
||||
* description:
|
||||
* type: string
|
||||
* description: The price list's description
|
||||
* type: string
|
||||
* example: Prices for VIP customers
|
||||
* type:
|
||||
* description: "The type of Price List. This can be one of either `sale` or `override`."
|
||||
* description: The type of Price List. This can be one of either `sale` or `override`.
|
||||
* type: string
|
||||
* enum:
|
||||
* - sale
|
||||
* - override
|
||||
* default: sale
|
||||
* status:
|
||||
* description: "The status of the Price List"
|
||||
* description: The status of the Price List
|
||||
* type: string
|
||||
* enum:
|
||||
* - active
|
||||
* - draft
|
||||
* default: draft
|
||||
* starts_at:
|
||||
* description: "The date with timezone that the Price List starts being valid."
|
||||
* description: The date with timezone that the Price List starts being valid.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* format: date-time
|
||||
* ends_at:
|
||||
* description: "The date with timezone that the Price List stops being valid."
|
||||
* description: The date with timezone that the Price List stops being valid.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* format: date-time
|
||||
* customer_groups:
|
||||
* description: The Customer Groups that the Price List applies to. Available if the relation `customer_groups` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* description: A customer group object.
|
||||
* $ref: "#/components/schemas/CustomerGroup"
|
||||
* prices:
|
||||
* description: The Money Amounts that are associated with the Price List. Available if the relation `prices` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* oneOf:
|
||||
* - $ref: "#/components/schemas/MoneyAmount"
|
||||
* - $ref: "#/components/schemas/CustomerGroup"
|
||||
* $ref: "#/components/schemas/MoneyAmount"
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Does the price list prices include tax"
|
||||
* type: boolean
|
||||
* default: false
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
*/
|
||||
|
||||
@@ -4,17 +4,15 @@ import { kebabCase } from "lodash"
|
||||
import { Product } from "."
|
||||
import {
|
||||
BeforeInsert,
|
||||
Index,
|
||||
Entity,
|
||||
Tree,
|
||||
Column,
|
||||
PrimaryGeneratedColumn,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
JoinTable,
|
||||
ManyToMany,
|
||||
Tree,
|
||||
TreeChildren,
|
||||
TreeParent,
|
||||
TreeLevelColumn,
|
||||
JoinColumn,
|
||||
ManyToMany,
|
||||
JoinTable,
|
||||
} from "typeorm"
|
||||
|
||||
@Entity()
|
||||
@@ -84,23 +82,34 @@ export class ProductCategory extends SoftDeletableEntity {
|
||||
* x-resourceId: ProductCategory
|
||||
* type: object
|
||||
* required:
|
||||
* - category_children
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - handle
|
||||
* - id
|
||||
* - is_active
|
||||
* - is_internal
|
||||
* - mpath
|
||||
* - name
|
||||
* - parent_category_id
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product category's ID
|
||||
* type: string
|
||||
* example: pcat_01G2SG30J8C85S4A5CHM2S1NS2
|
||||
* name:
|
||||
* type: string
|
||||
* description: The product category's name
|
||||
* type: string
|
||||
* example: Regular Fit
|
||||
* handle:
|
||||
* description: "A unique string that identifies the Category - example: slug structures."
|
||||
* description: A unique string that identifies the Product Category - can for example be used in slug structures.
|
||||
* type: string
|
||||
* example: regular-fit
|
||||
* mpath:
|
||||
* type: string
|
||||
* description: A string for Materialized Paths - used for finding ancestors and descendents
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: pcat_id1.pcat_id2.pcat_id3
|
||||
* is_internal:
|
||||
* type: boolean
|
||||
@@ -114,31 +123,32 @@ export class ProductCategory extends SoftDeletableEntity {
|
||||
* description: Available if the relation `category_children` are expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* description: A product category object.
|
||||
* $ref: "#/components/schemas/ProductCategory"
|
||||
* parent_category_id:
|
||||
* description: The ID of the parent category.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* default: null
|
||||
* parent_category:
|
||||
* description: A product category object. Available if the relation `parent_category` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ProductCategory"
|
||||
* products:
|
||||
* description: products associated with category. Available if the relation `products` is expanded.
|
||||
* description: Products associated with category. Available if the relation `products` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* description: A product object.
|
||||
* $ref: "#/components/schemas/Product"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
*/
|
||||
|
||||
@@ -38,40 +38,48 @@ export class ProductCollection extends SoftDeletableEntity {
|
||||
* description: "Product Collections represents a group of Products that are related."
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - handle
|
||||
* - id
|
||||
* - metadata
|
||||
* - title
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product collection's ID
|
||||
* type: string
|
||||
* example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
|
||||
* title:
|
||||
* description: "The title that the Product Collection is identified by."
|
||||
* description: The title that the Product Collection is identified by.
|
||||
* type: string
|
||||
* example: Summer Collection
|
||||
* handle:
|
||||
* description: "A unique string that identifies the Product Collection - can for example be used in slug structures."
|
||||
* description: A unique string that identifies the Product Collection - can for example be used in slug structures.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: summer-collection
|
||||
* products:
|
||||
* description: The Products contained in the Product Collection. Available if the relation `products` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* description: A product collection object.
|
||||
* $ref: "#/components/schemas/Product"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -51,46 +51,55 @@ export class ProductOptionValue extends SoftDeletableEntity {
|
||||
* description: "A value given to a Product Variant's option set. Product Variant have a Product Option Value for each of the Product Options defined on the Product."
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - id
|
||||
* - metadata
|
||||
* - option_id
|
||||
* - updated_at
|
||||
* - value
|
||||
* - variant_id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product option value's ID
|
||||
* type: string
|
||||
* example: optval_01F0YESHR7S6ECD03RF6W12DSJ
|
||||
* value:
|
||||
* description: "The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is \"Size\" this value could be \"Small\", \"Medium\" or \"Large\")."
|
||||
* description: The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is \"Size\" this value could be `Small`, `Medium` or `Large`).
|
||||
* type: string
|
||||
* example: large
|
||||
* option_id:
|
||||
* description: "The ID of the Product Option that the Product Option Value is defined for."
|
||||
* description: The ID of the Product Option that the Product Option Value is defined for.
|
||||
* type: string
|
||||
* example: opt_01F0YESHQBZVKCEXJ24BS6PCX3
|
||||
* option:
|
||||
* description: Available if the relation `option` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ProductOption"
|
||||
* variant_id:
|
||||
* description: "The ID of the Product Variant that the Product Option Value is defined for."
|
||||
* description: The ID of the Product Variant that the Product Option Value is defined for.
|
||||
* type: string
|
||||
* example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
|
||||
* variant:
|
||||
* description: Available if the relation `variant` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ProductVariant"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -45,15 +45,20 @@ export class ProductOption extends SoftDeletableEntity {
|
||||
* description: "Product Options define properties that may vary between different variants of a Product. Common Product Options are \"Size\" and \"Color\", but Medusa doesn't limit what Product Options that can be defined."
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - id
|
||||
* - metadata
|
||||
* - product_id
|
||||
* - title
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product option's ID
|
||||
* type: string
|
||||
* example: opt_01F0YESHQBZVKCEXJ24BS6PCX3
|
||||
* title:
|
||||
* description: "The title that the Product Option is defined by (e.g. \"Size\")."
|
||||
* description: The title that the Product Option is defined by (e.g. `Size`).
|
||||
* type: string
|
||||
* example: Size
|
||||
* values:
|
||||
@@ -62,26 +67,29 @@ export class ProductOption extends SoftDeletableEntity {
|
||||
* items:
|
||||
* $ref: "#/components/schemas/ProductOptionValue"
|
||||
* product_id:
|
||||
* description: "The ID of the Product that the Product Option is defined for."
|
||||
* description: The ID of the Product that the Product Option is defined for.
|
||||
* type: string
|
||||
* example: prod_01G1G5V2MBA328390B5AXJ610F
|
||||
* product:
|
||||
* description: A product object. Available if the relation `product` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Product"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -24,30 +24,37 @@ export class ProductTag extends SoftDeletableEntity {
|
||||
* description: "Product Tags can be added to Products for easy filtering and grouping."
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - id
|
||||
* - metadata
|
||||
* - updated_at
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product tag's ID
|
||||
* type: string
|
||||
* example: ptag_01G8K2MTMG9168F2B70S1TAVK3
|
||||
* value:
|
||||
* description: "The value that the Product Tag represents"
|
||||
* description: The value that the Product Tag represents
|
||||
* type: string
|
||||
* example: Pants
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -44,33 +44,39 @@ export class ProductTaxRate {
|
||||
* description: "Associates a tax rate with a product to indicate that the product is taxed in a certain way"
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - metadata
|
||||
* - product_id
|
||||
* - rate_id
|
||||
* - updated_at
|
||||
* properties:
|
||||
* product_id:
|
||||
* description: "The ID of the Product"
|
||||
* description: The ID of the Product
|
||||
* type: string
|
||||
* example: prod_01G1G5V2MBA328390B5AXJ610F
|
||||
* product:
|
||||
* description: Available if the relation `product` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Product"
|
||||
* rate_id:
|
||||
* description: "The ID of the Tax Rate"
|
||||
* description: The ID of the Tax Rate
|
||||
* type: string
|
||||
* example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
|
||||
* tax_rate:
|
||||
* description: Available if the relation `tax_rate` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/TaxRate"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -43,33 +43,39 @@ export class ProductTypeTaxRate {
|
||||
* description: "Associates a tax rate with a product type to indicate that the product type is taxed in a certain way"
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - metadata
|
||||
* - product_type_id
|
||||
* - rate_id
|
||||
* - updated_at
|
||||
* properties:
|
||||
* product_type_id:
|
||||
* description: "The ID of the Product type"
|
||||
* description: The ID of the Product type
|
||||
* type: string
|
||||
* example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
|
||||
* product_type:
|
||||
* description: Available if the relation `product_type` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ProductType"
|
||||
* rate_id:
|
||||
* description: "The id of the Tax Rate"
|
||||
* description: The id of the Tax Rate
|
||||
* type: string
|
||||
* example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
|
||||
* tax_rate:
|
||||
* description: Available if the relation `tax_rate` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/TaxRate"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -24,30 +24,37 @@ export class ProductType extends SoftDeletableEntity {
|
||||
* description: "Product Type can be added to Products for filtering and reporting purposes."
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - id
|
||||
* - metadata
|
||||
* - updated_at
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product type's ID
|
||||
* type: string
|
||||
* example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
|
||||
* value:
|
||||
* description: "The value that the Product Type represents."
|
||||
* description: The value that the Product Type represents.
|
||||
* type: string
|
||||
* example: Clothing
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {
|
||||
Index,
|
||||
BeforeInsert,
|
||||
Column,
|
||||
Entity,
|
||||
ManyToOne,
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
} from "typeorm"
|
||||
import { SoftDeletableEntity } from "../interfaces"
|
||||
import { generateEntityId } from "../utils"
|
||||
@@ -38,31 +38,44 @@ export class ProductVariantInventoryItem extends SoftDeletableEntity {
|
||||
* title: "Product Variant Inventory Item"
|
||||
* description: "Product Variant Inventory Items link variants with inventory items and denote the number of inventory items constituting a variant."
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - id
|
||||
* - inventory_item_id
|
||||
* - required_quantity
|
||||
* - updated_at
|
||||
* - variant_id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product variant inventory item's ID
|
||||
* type: string
|
||||
* example: pvitem_01G8X9A7ESKAJXG2H0E6F1MW7A
|
||||
* inventory_item_id:
|
||||
* description: "The id of the inventory item"
|
||||
* description: The id of the inventory item
|
||||
* type: string
|
||||
* variant_id:
|
||||
* description: "The id of the variant."
|
||||
* description: The id of the variant.
|
||||
* type: string
|
||||
* variant:
|
||||
* description: A ProductVariant object. Available if the relation `variant` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ProductVariant"
|
||||
* required_quantity:
|
||||
* description: "The quantity of an inventory item required for one quantity of the variant."
|
||||
* description: The quantity of an inventory item required for one quantity of the variant.
|
||||
* type: integer
|
||||
* default: 1
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
*/
|
||||
|
||||
@@ -116,92 +116,125 @@ export class ProductVariant extends SoftDeletableEntity {
|
||||
* description: "Product Variants represent a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations."
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* - product_id
|
||||
* - allow_backorder
|
||||
* - barcode
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - ean
|
||||
* - height
|
||||
* - hs_code
|
||||
* - id
|
||||
* - inventory_quantity
|
||||
* - length
|
||||
* - manage_inventory
|
||||
* - material
|
||||
* - metadata
|
||||
* - mid_code
|
||||
* - origin_country
|
||||
* - product_id
|
||||
* - sku
|
||||
* - title
|
||||
* - upc
|
||||
* - updated_at
|
||||
* - weight
|
||||
* - width
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product variant's ID
|
||||
* type: string
|
||||
* example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
|
||||
* title:
|
||||
* description: "A title that can be displayed for easy identification of the Product Variant."
|
||||
* description: A title that can be displayed for easy identification of the Product Variant.
|
||||
* type: string
|
||||
* example: Small
|
||||
* product_id:
|
||||
* description: "The ID of the Product that the Product Variant belongs to."
|
||||
* description: The ID of the Product that the Product Variant belongs to.
|
||||
* type: string
|
||||
* example: prod_01G1G5V2MBA328390B5AXJ610F
|
||||
* product:
|
||||
* description: A product object. Available if the relation `product` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/Product"
|
||||
* prices:
|
||||
* description: The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific Region. Available if the relation `prices` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/MoneyAmount"
|
||||
* sku:
|
||||
* description: "The unique stock keeping unit used to identify the Product Variant. This will usually be a unqiue identifer for the item that is to be shipped, and can be referenced across multiple systems."
|
||||
* description: The unique stock keeping unit used to identify the Product Variant. This will usually be a unqiue identifer for the item that is to be shipped, and can be referenced across multiple systems.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: shirt-123
|
||||
* barcode:
|
||||
* description: "A generic field for a GTIN number that can be used to identify the Product Variant."
|
||||
* description: A generic field for a GTIN number that can be used to identify the Product Variant.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* ean:
|
||||
* description: "An EAN barcode number that can be used to identify the Product Variant."
|
||||
* description: An EAN barcode number that can be used to identify the Product Variant.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* upc:
|
||||
* description: "A UPC barcode number that can be used to identify the Product Variant."
|
||||
* description: A UPC barcode number that can be used to identify the Product Variant.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* variant_rank:
|
||||
* description: The ranking of this variant
|
||||
* nullable: true
|
||||
* type: number
|
||||
* default: 0
|
||||
* inventory_quantity:
|
||||
* description: "The current quantity of the item that is stocked."
|
||||
* description: The current quantity of the item that is stocked.
|
||||
* type: integer
|
||||
* example: 100
|
||||
* allow_backorder:
|
||||
* description: "Whether the Product Variant should be purchasable when `inventory_quantity` is 0."
|
||||
* description: Whether the Product Variant should be purchasable when `inventory_quantity` is 0.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* manage_inventory:
|
||||
* description: "Whether Medusa should manage inventory for the Product Variant."
|
||||
* description: Whether Medusa should manage inventory for the Product Variant.
|
||||
* type: boolean
|
||||
* default: true
|
||||
* hs_code:
|
||||
* description: "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* origin_country:
|
||||
* description: "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* mid_code:
|
||||
* description: "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* material:
|
||||
* description: "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* weight:
|
||||
* description: "The weight of the Product Variant. May be used in shipping rate calculations."
|
||||
* type: number
|
||||
* example: null
|
||||
* height:
|
||||
* description: "The height of the Product Variant. May be used in shipping rate calculations."
|
||||
* type: number
|
||||
* example: null
|
||||
* width:
|
||||
* description: "The width of the Product Variant. May be used in shipping rate calculations."
|
||||
* description: The weight of the Product Variant. May be used in shipping rate calculations.
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* length:
|
||||
* description: "The length of the Product Variant. May be used in shipping rate calculations."
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* height:
|
||||
* description: The height of the Product Variant. May be used in shipping rate calculations.
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* width:
|
||||
* description: The width of the Product Variant. May be used in shipping rate calculations.
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* options:
|
||||
@@ -215,19 +248,21 @@ export class ProductVariant extends SoftDeletableEntity {
|
||||
* items:
|
||||
* $ref: "#/components/schemas/ProductVariantInventoryItem"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -194,30 +194,56 @@ export class Product extends SoftDeletableEntity {
|
||||
* description: "Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by."
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* - collection_id
|
||||
* - created_at
|
||||
* - deleted_at
|
||||
* - description
|
||||
* - discountable
|
||||
* - external_id
|
||||
* - handle
|
||||
* - height
|
||||
* - hs_code
|
||||
* - id
|
||||
* - is_giftcard
|
||||
* - length
|
||||
* - material
|
||||
* - metadata
|
||||
* - mid_code
|
||||
* - origin_country
|
||||
* - profile_id
|
||||
* - status
|
||||
* - subtitle
|
||||
* - type_id
|
||||
* - thumbnail
|
||||
* - title
|
||||
* - updated_at
|
||||
* - weight
|
||||
* - width
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The product's ID
|
||||
* type: string
|
||||
* example: prod_01G1G5V2MBA328390B5AXJ610F
|
||||
* title:
|
||||
* description: "A title that can be displayed for easy identification of the Product."
|
||||
* description: A title that can be displayed for easy identification of the Product.
|
||||
* type: string
|
||||
* example: Medusa Coffee Mug
|
||||
* subtitle:
|
||||
* description: "An optional subtitle that can be used to further specify the Product."
|
||||
* description: An optional subtitle that can be used to further specify the Product.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A short description of the Product."
|
||||
* description: A short description of the Product.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: Every programmer's best friend.
|
||||
* handle:
|
||||
* description: "A unique identifier for the Product (e.g. for slug structure)."
|
||||
* description: A unique identifier for the Product (e.g. for slug structure).
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: coffee-mug
|
||||
* is_giftcard:
|
||||
* description: "Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased."
|
||||
* description: Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* status:
|
||||
@@ -235,7 +261,8 @@ export class Product extends SoftDeletableEntity {
|
||||
* items:
|
||||
* $ref: "#/components/schemas/Image"
|
||||
* thumbnail:
|
||||
* description: "A URL to an image file that can be used to identify the Product."
|
||||
* description: A URL to an image file that can be used to identify the Product.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* format: uri
|
||||
* options:
|
||||
@@ -248,58 +275,76 @@ export class Product extends SoftDeletableEntity {
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/ProductVariant"
|
||||
* categories:
|
||||
* description: The product's associated categories. Available if the relation `categories` are expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/ProductCategory"
|
||||
* profile_id:
|
||||
* description: "The ID of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products."
|
||||
* description: The ID of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.
|
||||
* type: string
|
||||
* example: sp_01G1G5V239ENSZ5MV4JAR737BM
|
||||
* profile:
|
||||
* description: Available if the relation `profile` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ShippingProfile"
|
||||
* weight:
|
||||
* description: "The weight of the Product Variant. May be used in shipping rate calculations."
|
||||
* type: number
|
||||
* example: null
|
||||
* height:
|
||||
* description: "The height of the Product Variant. May be used in shipping rate calculations."
|
||||
* type: number
|
||||
* example: null
|
||||
* width:
|
||||
* description: "The width of the Product Variant. May be used in shipping rate calculations."
|
||||
* description: The weight of the Product Variant. May be used in shipping rate calculations.
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* length:
|
||||
* description: "The length of the Product Variant. May be used in shipping rate calculations."
|
||||
* description: The length of the Product Variant. May be used in shipping rate calculations.
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* height:
|
||||
* description: The height of the Product Variant. May be used in shipping rate calculations.
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* width:
|
||||
* description: The width of the Product Variant. May be used in shipping rate calculations.
|
||||
* nullable: true
|
||||
* type: number
|
||||
* example: null
|
||||
* hs_code:
|
||||
* description: "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* origin_country:
|
||||
* description: "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* mid_code:
|
||||
* description: "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* material:
|
||||
* description: "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers."
|
||||
* description: The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* collection_id:
|
||||
* type: string
|
||||
* description: The Product Collection that the Product belongs to
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
|
||||
* collection:
|
||||
* description: A product collection object. Available if the relation `collection` is expanded.
|
||||
* type: object
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ProductCollection"
|
||||
* type_id:
|
||||
* type: string
|
||||
* description: The Product type that the Product belongs to
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
|
||||
* type:
|
||||
* description: Available if the relation `type` is expanded.
|
||||
* nullable: true
|
||||
* $ref: "#/components/schemas/ProductType"
|
||||
* tags:
|
||||
* description: The Product Tags assigned to the Product. Available if the relation `tags` is expanded.
|
||||
@@ -307,39 +352,35 @@ export class Product extends SoftDeletableEntity {
|
||||
* items:
|
||||
* $ref: "#/components/schemas/ProductTag"
|
||||
* discountable:
|
||||
* description: "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`."
|
||||
* description: Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`.
|
||||
* type: boolean
|
||||
* default: true
|
||||
* external_id:
|
||||
* description: The external ID of the product
|
||||
* nullable: true
|
||||
* type: string
|
||||
* example: null
|
||||
* sales_channels:
|
||||
* description: The sales channels the product is associated with. Available if the relation `sales_channels` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* description: A sales channel object.
|
||||
* categories:
|
||||
* description: The product's associated categories. Available if the relation `categories` is expanded.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* description: A category object.
|
||||
* $ref: "#/components/schemas/SalesChannel"
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
* deleted_at:
|
||||
* description: The date with timezone at which the resource was deleted.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was deleted."
|
||||
* format: date-time
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* nullable: true
|
||||
* type: object
|
||||
* example: {car: "white"}
|
||||
*/
|
||||
|
||||
@@ -17,13 +17,16 @@ export class PublishableApiKeySalesChannel {
|
||||
* title: "Publishable API key sales channel"
|
||||
* description: "Holds mapping between Publishable API keys and Sales Channels"
|
||||
* type: object
|
||||
* required:
|
||||
* - publishable_key_id
|
||||
* - sales_channel_id
|
||||
* properties:
|
||||
* sales_channel_id:
|
||||
* type: string
|
||||
* description: The sales channel's ID
|
||||
* type: string
|
||||
* example: sc_01G1G5V21KADXNGH29BJMAJ4B4
|
||||
* publishable_key_id:
|
||||
* type: string
|
||||
* description: The publishable API key's ID
|
||||
* type: string
|
||||
* example: pak_01G1G5V21KADXNGH29BJMAJ4B4
|
||||
*/
|
||||
|
||||
@@ -31,35 +31,43 @@ export class PublishableApiKey extends BaseEntity {
|
||||
* title: "Publishable API key"
|
||||
* description: "Publishable API key defines scopes (i.e. resources) that are available within a request."
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - created_by
|
||||
* - id
|
||||
* - revoked_by
|
||||
* - revoked_at
|
||||
* - title
|
||||
* - updated_at
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The key's ID
|
||||
* type: string
|
||||
* example: pk_01G1G5V27GYX4QXNARRQCW1N8T
|
||||
* created_by:
|
||||
* description: The unique identifier of the user that created the key.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The unique identifier of the user that created the key."
|
||||
* example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
|
||||
* created_by_user:
|
||||
* description: A user object. Available if the relation `created_by_user` is expanded.
|
||||
* type: object
|
||||
* created_at:
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was created."
|
||||
* format: date-time
|
||||
* revoked_by:
|
||||
* description: The unique identifier of the user that revoked the key.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* description: "The unique identifier of the user that revoked the key."
|
||||
* example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
|
||||
* revoked_by_user:
|
||||
* description: A user object. Available if the relation `revoked_by_user` is expanded.
|
||||
* type: object
|
||||
* revoked_at:
|
||||
* description: The date with timezone at which the key was revoked.
|
||||
* nullable: true
|
||||
* type: string
|
||||
* format: date-time
|
||||
* title:
|
||||
* description: The key's title.
|
||||
* type: string
|
||||
* created_at:
|
||||
* description: The date with timezone at which the resource was created.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the key was revoked."
|
||||
* format: date-time
|
||||
* updated_at:
|
||||
* description: The date with timezone at which the resource was updated.
|
||||
* type: string
|
||||
* description: "The date with timezone at which the resource was updated."
|
||||
* format: date-time
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user