chore(oas): PascalCase for schemas + remove x-resourceId (#2847)

### What

Rename all JSDoc OAS `@schema` and `$ref: #/components/schemas/` from snake_case to PascalCase, `foo_bar -> FooBar`

Extra scope: Remove `x-resourceId` from JSDoc OAS.

### Why

Classes use PascalCase as a convention but the OAS @schemas describing them were using snake_case. OAS code generators tend to use the schema name when generating typed models.

In order to avoid mismatch between source code, the OAS, and the generated client code, it is advised to align OAS @schemas formatting to the classes they represent.

Extra scope: x-resourceId is not a widely used OAS property. It's current usage in our OAS does not provide additional value. Therefore, we recommend to remove it in order to have one less item to maintain.

### How

Good old search & replace. Regex search to further make sure we didn't miss any.

The scope is limited to `@schema` definition and their usage in `$ref: #/components/schemas/`.

### Test

* Ran OAS validator.
* Ran docs build script.

Expect no visible changes to the documentation.

Resolves: CORE-852, CORE-859
This commit is contained in:
Patrick
2022-12-20 05:58:57 -05:00
committed by GitHub
parent 2e5ceb7950
commit a027d5ff9e
319 changed files with 654 additions and 747 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
chore(oas): PascalCase for schemas + remove x-resourceId

View File

@@ -55,111 +55,82 @@ info:
name: MIT
url: https://github.com/medusajs/medusa/blob/master/LICENSE
tags:
- name: Auth
description: Auth endpoints that allow authorization of admin Users and manages
their sessions.
- name: App
description: App endpoints that allow handling apps in Medusa.
x-resourceId: OAuth
- name: Batch Job
description: Batch Job endpoints that allow handling batch jobs in Medusa.
x-resourceId: batch_job
- name: Claim
description: Claim endpoints that allow handling claims in Medusa.
x-resourceId: claim_order
- name: Collection
description: Collection endpoints that allow handling collections in Medusa.
x-resourceId: product_collection
- name: Customer
description: Customer endpoints that allow handling customers in Medusa.
x-resourceId: customer
- name: Customer Group
description: Customer Group endpoints that allow handling customer groups in Medusa.
x-resourceId: customer_group
- name: Discount
description: Discount endpoints that allow handling discounts in Medusa.
x-resourceId: discount
- name: Discount Condition
description: Discount Condition endpoints that allow handling discount conditions
in Medusa.
x-resourceId: discount_condition
- name: Draft Order
description: Draft Order endpoints that allow handling draft orders in Medusa.
x-resourceId: draft-order
- name: Gift Card
description: Gift Card endpoints that allow handling gift cards in Medusa.
x-resourceId: gift_card
- name: Invite
description: Invite endpoints that allow handling invites in Medusa.
x-resourceId: invite
- name: Note
description: Note endpoints that allow handling notes in Medusa.
x-resourceId: note
- name: Notification
description: Notification endpoints that allow handling notifications in Medusa.
x-resourceId: notification
- name: Order
description: Order endpoints that allow handling orders in Medusa.
x-resourceId: order
- name: Price List
description: Price List endpoints that allow handling price lists in Medusa.
x-resourceId: price_list
- name: Product
description: Product endpoints that allow handling products in Medusa.
x-resourceId: product
- name: Product Tag
description: Product Tag endpoints that allow handling product tags in Medusa.
x-resourceId: product_tag
- name: Product Type
description: Product Types endpoints that allow handling product types in Medusa.
x-resourceId: product_type
- name: Product Variant
description: Product Variant endpoints that allow handling product variants in Medusa.
x-resourceId: product_variant
- name: Region
description: Region endpoints that allow handling regions in Medusa.
x-resourceId: region
- name: Return Reason
description: Return Reason endpoints that allow handling return reasons in Medusa.
x-resourceId: return_reason
- name: Return
description: Return endpoints that allow handling returns in Medusa.
x-resourceId: return
- name: Sales Channel
description: Sales Channel endpoints that allow handling sales channels in Medusa.
x-resourceId: sales_channel
- name: Shipping Option
description: Shipping Option endpoints that allow handling shipping options in Medusa.
x-resourceId: shipping_option
- name: Shipping Profile
description: Shipping Profile endpoints that allow handling shipping profiles in
Medusa.
x-resourceId: shipping_profile
- name: Store
description: Store endpoints that allow handling stores in Medusa.
x-resourceId: store
- name: Swap
description: Swap endpoints that allow handling swaps in Medusa.
x-resourceId: swap
- name: Tax Rate
description: Tax Rate endpoints that allow handling tax rates in Medusa.
x-resourceId: tax_rate
- name: Upload
description: Upload endpoints that allow handling uploads in Medusa.
- name: User
description: User endpoints that allow handling users in Medusa.
x-resourceId: user
- name: Auth
description: Auth endpoints that allow authorization of admin Users and manages
their sessions.
- name: App
description: App endpoints that allow handling apps in Medusa.
- name: Batch Job
description: Batch Job endpoints that allow handling batch jobs in Medusa.
- name: Claim
description: Claim endpoints that allow handling claims in Medusa.
- name: Collection
description: Collection endpoints that allow handling collections in Medusa.
- name: Customer
description: Customer endpoints that allow handling customers in Medusa.
- name: Customer Group
description: Customer Group endpoints that allow handling customer groups in Medusa.
- name: Discount
description: Discount endpoints that allow handling discounts in Medusa.
- name: Discount Condition
description: Discount Condition endpoints that allow handling discount conditions
in Medusa.
- name: Draft Order
description: Draft Order endpoints that allow handling draft orders in Medusa.
- name: Gift Card
description: Gift Card endpoints that allow handling gift cards in Medusa.
- name: Invite
description: Invite endpoints that allow handling invites in Medusa.
- name: Note
description: Note endpoints that allow handling notes in Medusa.
- name: Notification
description: Notification endpoints that allow handling notifications in Medusa.
- name: Order
description: Order endpoints that allow handling orders in Medusa.
- name: Price List
description: Price List endpoints that allow handling price lists in Medusa.
- name: Product
description: Product endpoints that allow handling products in Medusa.
- name: Product Tag
description: Product Tag endpoints that allow handling product tags in Medusa.
- name: Product Type
description: Product Types endpoints that allow handling product types in Medusa.
- name: Product Variant
description: Product Variant endpoints that allow handling product variants in Medusa.
- name: Region
description: Region endpoints that allow handling regions in Medusa.
- name: Return Reason
description: Return Reason endpoints that allow handling return reasons in Medusa.
- name: Return
description: Return endpoints that allow handling returns in Medusa.
- name: Sales Channel
description: Sales Channel endpoints that allow handling sales channels in Medusa.
- name: Shipping Option
description: Shipping Option endpoints that allow handling shipping options in Medusa.
- name: Shipping Profile
description: Shipping Profile endpoints that allow handling shipping profiles in
Medusa.
- name: Store
description: Store endpoints that allow handling stores in Medusa.
- name: Swap
description: Swap endpoints that allow handling swaps in Medusa.
- name: Tax Rate
description: Tax Rate endpoints that allow handling tax rates in Medusa.
- name: Upload
description: Upload endpoints that allow handling uploads in Medusa.
- name: User
description: User endpoints that allow handling users in Medusa.
servers:
- url: https://api.medusa-commerce.com/admin
paths: {}
- url: https://api.medusa-commerce.com/admin
paths: { }
components:
responses:
responses:
default_error:
description: Default Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
code: "unknown_error"
message: "An unknown error occurred."
@@ -168,8 +139,8 @@ components:
description: Invalid State Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
code: "unknown_error"
message: "The request conflicted with another request. You may retry the request with the provided Idempotency-Key."
@@ -178,8 +149,8 @@ components:
description: Invalid Request Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
code: "invalid_request_error"
message: "Discount with code TEST already exists."
@@ -188,8 +159,8 @@ components:
description: Not Found Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
message: "Entity with id 1 was not found"
type: "not_found"
@@ -198,23 +169,23 @@ components:
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/error"
- $ref: "#/components/schemas/multiple_errors"
examples:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/MultipleErrors"
examples:
not_allowed:
$ref: "#/components/examples/not_allowed_error"
invalid_data:
$ref: "#/components/examples/invalid_data_error"
multiple_errors:
MultipleErrors:
$ref: "#/components/examples/multiple_errors"
500_error:
description: Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
examples:
schema:
$ref: "#/components/schemas/Error"
examples:
database:
$ref: "#/components/examples/database_error"
unexpected_state:
@@ -225,17 +196,17 @@ components:
$ref: "#/components/examples/default_error"
unauthorized:
description: 'User is not authorized. Must log in first'
content:
content:
text/plain:
schema:
schema:
type: string
default: Unauthorized
example: Unauthorized
incorrect_credentials:
description: 'User does not exist or incorrect credentials'
content:
content:
text/plain:
schema:
schema:
type: string
default: Unauthorized
example: Unauthorized

View File

@@ -50,61 +50,49 @@ info:
`count` is the total number of available items of this entity. It can be used to determine how many pages are there.
For example, if the `count` is 100 and the `limit` is 50, you can divide the `count` by the `limit` to get the number of pages: `100/50 = 2 pages`.
license:
name: MIT
url: https://github.com/medusajs/medusa/blob/master/LICENSE
tags:
- name: Auth
description: Auth endpoints that allow authorization of customers and manages their
sessions.
- name: Cart
description: Cart endpoints that allow handling carts in Medusa.
x-resourceId: cart
- name: Collection
description: Collection endpoints that allow handling collections in Medusa.
x-resourceId: product_collection
- name: Customer
description: Customer endpoints that allow handling customers in Medusa.
x-resourceId: customer
- name: Gift Card
description: Gift Card endpoints that allow handling gift cards in Medusa.
x-resourceId: gift_card
- name: Order
description: Order endpoints that allow handling orders in Medusa.
x-resourceId: order
- name: Product
description: Product endpoints that allow handling products in Medusa.
x-resourceId: product
- name: Product Variant
description: Product Variant endpoints that allow handling product variants in Medusa.
x-resourceId: product_variant
- name: Region
description: Region endpoints that allow handling regions in Medusa.
x-resourceId: region
- name: Return Reason
description: Return Reason endpoints that allow handling return reasons in Medusa.
x-resourceId: return_reason
- name: Return
description: Return endpoints that allow handling returns in Medusa.
x-resourceId: return
- name: Shipping Option
description: Shipping Option endpoints that allow handling shipping options in Medusa.
x-resourceId: shipping_option
- name: Swap
description: Swap endpoints that allow handling swaps in Medusa.
x-resourceId: swap
- name: Auth
description: Auth endpoints that allow authorization of customers and manages their
sessions.
- name: Cart
description: Cart endpoints that allow handling carts in Medusa.
- name: Collection
description: Collection endpoints that allow handling collections in Medusa.
- name: Customer
description: Customer endpoints that allow handling customers in Medusa.
- name: Gift Card
description: Gift Card endpoints that allow handling gift cards in Medusa.
- name: Order
description: Order endpoints that allow handling orders in Medusa.
- name: Product
description: Product endpoints that allow handling products in Medusa.
- name: Product Variant
description: Product Variant endpoints that allow handling product variants in Medusa.
- name: Region
description: Region endpoints that allow handling regions in Medusa.
- name: Return Reason
description: Return Reason endpoints that allow handling return reasons in Medusa.
- name: Return
description: Return endpoints that allow handling returns in Medusa.
- name: Shipping Option
description: Shipping Option endpoints that allow handling shipping options in Medusa.
- name: Swap
description: Swap endpoints that allow handling swaps in Medusa.
servers:
- url: https://api.medusa-commerce.com/store
paths: {}
- url: https://api.medusa-commerce.com/store
paths: { }
components:
responses:
responses:
default_error:
description: Default Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
code: "unknown_error"
message: "An unknown error occurred."
@@ -113,8 +101,8 @@ components:
description: Invalid State Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
code: "unknown_error"
message: "The request conflicted with another request. You may retry the request with the provided Idempotency-Key."
@@ -123,8 +111,8 @@ components:
description: Invalid Request Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
code: "invalid_request_error"
message: "Discount with code TEST already exists."
@@ -133,8 +121,8 @@ components:
description: Not Found Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
schema:
$ref: "#/components/schemas/Error"
example:
message: "Entity with id 1 was not found"
type: "not_found"
@@ -143,23 +131,23 @@ components:
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/error"
- $ref: "#/components/schemas/multiple_errors"
examples:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/MultipleErrors"
examples:
not_allowed:
$ref: "#/components/examples/not_allowed_error"
invalid_data:
$ref: "#/components/examples/invalid_data_error"
multiple_errors:
MultipleErrors:
$ref: "#/components/examples/multiple_errors"
500_error:
description: Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/error"
examples:
schema:
$ref: "#/components/schemas/Error"
examples:
database:
$ref: "#/components/examples/database_error"
unexpected_state:
@@ -170,17 +158,17 @@ components:
$ref: "#/components/examples/default_error"
unauthorized:
description: 'User is not authorized. Must log in first'
content:
content:
text/plain:
schema:
schema:
type: string
default: Unauthorized
example: Unauthorized
incorrect_credentials:
description: 'User does not exist or incorrect credentials'
content:
content:
text/plain:
schema:
schema:
type: string
default: Unauthorized
example: Unauthorized

View File

@@ -17,16 +17,15 @@ export default (fn: handler): RequestHandler => {
}
/**
* @schema multiple_errors
* @schema MultipleErrors
* title: "Multiple Errors"
* x-resourceId: multiple_errors
* type: object
* properties:
* errors:
* type: array
* description: Array of errors
* items:
* $ref: "#/components/schemas/error"
* $ref: "#/components/schemas/Error"
* message:
* type: string
* default: "Provided request body contains errors. Please check the data and retry the request"

View File

@@ -79,9 +79,8 @@ export default () => {
}
/**
* @schema error
* @schema Error
* title: "Response Error"
* x-resourceId: error
* type: object
* properties:
* code:

View File

@@ -65,7 +65,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* user:
* $ref: "#/components/schemas/user"
* $ref: "#/components/schemas/User"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -37,7 +37,7 @@ import _ from "lodash"
* type: object
* properties:
* user:
* $ref: "#/components/schemas/user"
* $ref: "#/components/schemas/User"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -39,7 +39,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* batch_job:
* $ref: "#/components/schemas/batch_job"
* $ref: "#/components/schemas/BatchJob"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -39,7 +39,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* batch_job:
* $ref: "#/components/schemas/batch_job"
* $ref: "#/components/schemas/BatchJob"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -85,7 +85,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* batch_job:
* $ref: "#/components/schemas/batch_job"
* $ref: "#/components/schemas/BatchJob"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -36,7 +36,7 @@
* type: object
* properties:
* batch_job:
* $ref: "#/components/schemas/batch_job"
* $ref: "#/components/schemas/BatchJob"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -242,7 +242,7 @@ import { isDefined } from "medusa-core-utils"
* batch_jobs:
* type: array
* items:
* $ref: "#/components/schemas/batch_job"
* $ref: "#/components/schemas/BatchJob"
* count:
* type: integer
* description: The total number of items available

View File

@@ -52,7 +52,7 @@ import ProductCollectionService from "../../../../services/product-collection"
* type: object
* properties:
* collection:
* $ref: "#/components/schemas/product_collection"
* $ref: "#/components/schemas/ProductCollection"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -62,7 +62,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* collection:
* $ref: "#/components/schemas/product_collection"
* $ref: "#/components/schemas/ProductCollection"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -2,6 +2,7 @@ import { Request, Response } from "express"
import ProductCollectionService from "../../../../services/product-collection"
import { defaultAdminCollectionsRelations } from "."
/**
* @oas [get] /collections/{id}
* operationId: "GetCollectionsCollection"
@@ -40,7 +41,7 @@ import { defaultAdminCollectionsRelations } from "."
* type: object
* properties:
* collection:
* $ref: "#/components/schemas/product_collection"
* $ref: "#/components/schemas/ProductCollection"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -116,7 +116,7 @@ import { Type } from "class-transformer"
* collections:
* type: array
* items:
* $ref: "#/components/schemas/product_collection"
* $ref: "#/components/schemas/ProductCollection"
* count:
* type: integer
* description: The total number of items available

View File

@@ -62,7 +62,7 @@ import ProductCollectionService from "../../../../services/product-collection"
* type: object
* properties:
* collection:
* $ref: "#/components/schemas/product_collection"
* $ref: "#/components/schemas/ProductCollection"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -47,7 +47,7 @@ import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators
* currencies:
* type: array
* items:
* $ref: "#/components/schemas/currency"
* $ref: "#/components/schemas/Currency"
* count:
* type: integer
* description: The total number of items available

View File

@@ -55,7 +55,7 @@ import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/ta
* type: object
* properties:
* currency:
* $ref: "#/components/schemas/currency"
* $ref: "#/components/schemas/Currency"
*/
export default async (req: ExtendedRequest<Currency>, res) => {
const code = req.params.code as string

View File

@@ -77,7 +77,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* customer_group:
* $ref: "#/components/schemas/customer_group"
* $ref: "#/components/schemas/CustomerGroup"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -50,7 +50,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* customer_group:
* $ref: "#/components/schemas/customer_group"
* $ref: "#/components/schemas/CustomerGroup"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -77,7 +77,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* customer_group:
* $ref: "#/components/schemas/customer_group"
* $ref: "#/components/schemas/CustomerGroup"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -42,7 +42,7 @@ import CustomerController from "../../../../controllers/customers"
* customers:
* type: array
* items:
* $ref: "#/components/schemas/customer"
* $ref: "#/components/schemas/Customer"
* count:
* type: integer
* description: The total number of items available

View File

@@ -43,7 +43,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* customer_group:
* $ref: "#/components/schemas/customer_group"
* $ref: "#/components/schemas/CustomerGroup"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -132,7 +132,7 @@ import { Type } from "class-transformer"
* customer_groups:
* type: array
* items:
* $ref: "#/components/schemas/customer_group"
* $ref: "#/components/schemas/CustomerGroup"
* count:
* type: integer
* description: The total number of items available

View File

@@ -63,7 +63,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* customer_group:
* $ref: "#/components/schemas/customer_group"
* $ref: "#/components/schemas/CustomerGroup"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -83,7 +83,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* customer:
* $ref: "#/components/schemas/customer"
* $ref: "#/components/schemas/Customer"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -43,7 +43,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* customer:
* $ref: "#/components/schemas/customer"
* $ref: "#/components/schemas/Customer"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -48,7 +48,7 @@ import customerController from "../../../../controllers/customers"
* customers:
* type: array
* items:
* $ref: "#/components/schemas/customer"
* $ref: "#/components/schemas/Customer"
* count:
* type: integer
* description: The total number of items available

View File

@@ -97,7 +97,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* customer:
* $ref: "#/components/schemas/customer"
* $ref: "#/components/schemas/Customer"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -43,7 +43,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -74,7 +74,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -92,7 +92,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -152,7 +152,7 @@ import { FindParams } from "../../../../types/common"
* value: 10,
* allocation: AllocationType.ITEM
* },
* regions: ['reg_XXXXXXXX'],
* regions: ["reg_XXXXXXXX"],
* is_dynamic: false,
* is_disabled: false
* })
@@ -172,7 +172,7 @@ import { FindParams } from "../../../../types/common"
* "value": 10,
* "allocation": "item"
* },
* "regions": ['reg_XXXXXXXX']
* "regions": ["reg_XXXXXXXX"]
* }'
* security:
* - api_token: []
@@ -188,7 +188,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -59,7 +59,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -57,7 +57,7 @@ import { FindParams } from "../../../../types/common"
* default: true
* discount:
* description: The Discount to which the condition used to belong
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -42,7 +42,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -73,7 +73,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -43,7 +43,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount_condition:
* $ref: "#/components/schemas/discount_condition"
* $ref: "#/components/schemas/DiscountCondition"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -42,7 +42,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -42,7 +42,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -71,7 +71,7 @@ import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean"
* discounts:
* type: array
* items:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* count:
* type: integer
* description: The total number of items available

View File

@@ -42,7 +42,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -87,7 +87,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -162,7 +162,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* discount:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -25,6 +25,7 @@ import { AddressPayload } from "../../../../types/common"
import { DraftOrderCreateProps } from "../../../../types/draft-orders"
import { validator } from "../../../../utils/validator"
import { IsType } from "../../../../utils/validators/is-type"
/**
* @oas [post] /draft-orders
* operationId: "PostDraftOrders"
@@ -53,12 +54,12 @@ import { IsType } from "../../../../utils/validators/is-type"
* billing_address:
* description: "The Address to be used for billing purposes."
* anyOf:
* - $ref: "#/components/schemas/address_fields"
* - $ref: "#/components/schemas/AddressFields"
* - type: string
* shipping_address:
* description: "The Address to be used for shipping."
* anyOf:
* - $ref: "#/components/schemas/address_fields"
* - $ref: "#/components/schemas/AddressFields"
* - type: string
* items:
* description: The Line Items that have been received.
@@ -181,7 +182,7 @@ import { IsType } from "../../../../utils/validators/is-type"
* type: object
* properties:
* draft_order:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -82,7 +82,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* draft_order:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -48,7 +48,7 @@ import { MedusaError } from "medusa-core-utils"
* type: object
* properties:
* draft_order:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -46,7 +46,7 @@ import { DraftOrder } from "../../../.."
* type: object
* properties:
* draft_order:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -53,7 +53,7 @@ import { validator } from "../../../../utils/validator"
* draft_orders:
* type: array
* items:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* count:
* type: integer
* description: The total number of items available

View File

@@ -49,7 +49,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -19,6 +19,7 @@ import { CartUpdateProps } from "../../../../types/cart"
import { AddressPayload } from "../../../../types/common"
import { validator } from "../../../../utils/validator"
import { IsType } from "../../../../utils/validators/is-type"
/**
* @oas [post] /admin/draft-orders/{id}
* operationId: PostDraftOrdersDraftOrder
@@ -49,12 +50,12 @@ import { IsType } from "../../../../utils/validators/is-type"
* billing_address:
* description: "The Address to be used for billing purposes."
* anyOf:
* - $ref: "#/components/schemas/address_fields"
* - $ref: "#/components/schemas/AddressFields"
* - type: string
* shipping_address:
* description: "The Address to be used for shipping."
* anyOf:
* - $ref: "#/components/schemas/address_fields"
* - $ref: "#/components/schemas/AddressFields"
* - type: string
* discounts:
* description: "An array of Discount codes to add to the Draft Order."
@@ -109,7 +110,7 @@ import { IsType } from "../../../../utils/validators/is-type"
* type: object
* properties:
* draft_order:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -75,7 +75,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* draft_order:
* $ref: "#/components/schemas/draft-order"
* $ref: "#/components/schemas/DraftOrder"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -72,7 +72,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* gift_card:
* $ref: "#/components/schemas/gift_card"
* $ref: "#/components/schemas/GiftCard"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -38,7 +38,7 @@ import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "./"
* type: object
* properties:
* gift_card:
* $ref: "#/components/schemas/gift_card"
* $ref: "#/components/schemas/GiftCard"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -48,7 +48,7 @@ import { isDefined } from "medusa-core-utils"
* gift_cards:
* type: array
* items:
* $ref: "#/components/schemas/gift_card"
* $ref: "#/components/schemas/GiftCard"
* count:
* type: integer
* description: The total number of items available

View File

@@ -72,7 +72,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* gift_card:
* $ref: "#/components/schemas/gift_card"
* $ref: "#/components/schemas/GiftCard"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -38,7 +38,7 @@ import InviteService from "../../../../services/invite"
* invites:
* type: array
* items:
* $ref: "#/components/schemas/invite"
* $ref: "#/components/schemas/Invite"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -69,7 +69,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* note:
* $ref: "#/components/schemas/note"
* $ref: "#/components/schemas/Note"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -38,7 +38,7 @@ import NoteService from "../../../../services/note"
* type: object
* properties:
* note:
* $ref: "#/components/schemas/note"
* $ref: "#/components/schemas/Note"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -47,7 +47,7 @@ import { validator } from "../../../../utils/validator"
* notes:
* type: array
* items:
* $ref: "#/components/schemas/note"
* $ref: "#/components/schemas/Note"
* count:
* type: integer
* description: The total number of items available

View File

@@ -58,7 +58,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* note:
* $ref: "#/components/schemas/note"
* $ref: "#/components/schemas/Note"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -59,7 +59,7 @@ import { validator } from "../../../../utils/validator"
* notifications:
* type: array
* items:
* $ref: "#/components/schemas/notification"
* $ref: "#/components/schemas/Notification"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -4,8 +4,7 @@ import {
} from "."
import { EntityManager } from "typeorm"
import { IsOptional } from "class-validator"
import { IsString } from "class-validator"
import { IsOptional, IsString } from "class-validator"
import { Notification } from "../../../../models"
import { NotificationService } from "../../../../services"
import { validator } from "../../../../utils/validator"
@@ -57,7 +56,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* notification:
* $ref: "#/components/schemas/notification"
* $ref: "#/components/schemas/Notification"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -42,8 +42,8 @@ import {
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
* // must be previously logged in or use api token
* medusa.admin.orderEdits.addLineItem(order_edit_id, {
* variant_id,
* quantity
* variant_id,
* quantity
* })
* .then(({ order_edit }) => {
* console.log(order_edit.id)
@@ -69,7 +69,7 @@ import {
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -44,7 +44,7 @@ import {
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -44,7 +44,7 @@ import {
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -59,7 +59,7 @@ import {
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -1,7 +1,6 @@
import { EntityManager } from "typeorm"
import { OrderEditService } from "../../../../services"
import { Request, Response } from "express"
import { IsNumber } from "class-validator"
import {
defaultOrderEditFields,
defaultOrderEditRelations,
@@ -46,7 +45,7 @@ import {
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -42,7 +42,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -47,7 +47,7 @@ import { IsOptional, IsString } from "class-validator"
* properties:
* order_edits:
* type: array
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* count:
* type: integer
* description: The total number of items available

View File

@@ -1,5 +1,5 @@
import { EntityManager } from "typeorm"
import { IsOptional, IsString, IsObject } from "class-validator"
import { IsOptional, IsString } from "class-validator"
import {
OrderEditService,
OrderService,
@@ -49,7 +49,7 @@ import { PaymentCollectionType } from "../../../../models"
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -61,7 +61,7 @@ import {
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -61,7 +61,7 @@ import {
* type: object
* properties:
* order_edit:
* $ref: "#/components/schemas/order_edit"
* $ref: "#/components/schemas/OrderEdit"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -60,7 +60,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -39,7 +39,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -43,7 +43,7 @@ import { MedusaError } from "medusa-core-utils"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -48,7 +48,7 @@ import { MedusaError } from "medusa-core-utils"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -48,7 +48,7 @@ import { MedusaError } from "medusa-core-utils"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -43,7 +43,7 @@ import { MedusaError } from "medusa-core-utils"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -41,7 +41,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -43,7 +43,7 @@ import { MedusaError } from "medusa-core-utils"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -41,7 +41,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -39,7 +39,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -66,7 +66,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -117,7 +117,7 @@ import { validator } from "../../../../utils/validator"
* shipping_address:
* type: object
* description: "An optional shipping address to send the claim to. Defaults to the parent order's shipping address"
* $ref: "#/components/schemas/address"
* $ref: "#/components/schemas/Address"
* refund_amount:
* description: The amount to refund the Customer when the Claim type is `refund`.
* type: integer
@@ -175,7 +175,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -98,7 +98,7 @@ import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -75,7 +75,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -75,7 +75,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -152,7 +152,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -56,7 +56,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -56,7 +56,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -38,7 +38,7 @@ import { OrderService } from "../../../../services"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -185,7 +185,7 @@ import { pick } from "lodash"
* orders:
* type: array
* items:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* count:
* type: integer
* description: The total number of items available

View File

@@ -42,7 +42,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -78,7 +78,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -126,7 +126,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -142,7 +142,7 @@ import { EntityManager } from "typeorm"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -36,16 +36,16 @@ import { validator } from "../../../../utils/validator"
* billing_address:
* description: Billing address
* anyOf:
* - $ref: "#/components/schemas/address_fields"
* - $ref: "#/components/schemas/AddressFields"
* shipping_address:
* description: Shipping address
* anyOf:
* - $ref: "#/components/schemas/address_fields"
* - $ref: "#/components/schemas/AddressFields"
* items:
* description: The Line Items for the order
* type: array
* items:
* $ref: "#/components/schemas/line_item"
* $ref: "#/components/schemas/LineItem"
* region:
* description: ID of the region where the order belongs
* type: string
@@ -53,7 +53,7 @@ import { validator } from "../../../../utils/validator"
* description: Discounts applied to the order
* type: array
* items:
* $ref: "#/components/schemas/discount"
* $ref: "#/components/schemas/Discount"
* customer_id:
* description: ID of the customer
* type: string
@@ -86,7 +86,7 @@ import { validator } from "../../../../utils/validator"
* items:
* type: array
* items:
* $ref: "#/components/schemas/line_item"
* $ref: "#/components/schemas/LineItem"
* description: Items to ship
* no_notification:
* description: A flag to indicate if no notifications should be emitted related to the updated order.
@@ -127,7 +127,7 @@ import { validator } from "../../../../utils/validator"
* type: object
* properties:
* order:
* $ref: "#/components/schemas/order"
* $ref: "#/components/schemas/Order"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

View File

@@ -41,7 +41,7 @@ import { FindParams } from "../../../../types/common"
* type: object
* properties:
* payment_collection:
* $ref: "#/components/schemas/payment_collection"
* $ref: "#/components/schemas/PaymentCollection"
* "400":
* $ref: "#/components/responses/400_error"
* "401":

Some files were not shown because too many files have changed in this diff Show More