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 authored and GitHub committed 2022-12-20 10:58:57 +00:00
1 parent 2e5ceb7950
commit a027d5ff9e
319 files changed
+569 -662

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
chore(oas): PascalCase for schemas + remove x-resourceId
+41 -70
View File
@@ -55,103 +55,74 @@ info:
name: MIT
url: https://github.com/medusajs/medusa/blob/master/LICENSE
tags:
- name: Auth
- name: Auth
description: Auth endpoints that allow authorization of admin Users and manages
their sessions.
- name: App
- name: App
description: App endpoints that allow handling apps in Medusa.
x-resourceId: OAuth
- name: Batch Job
- name: Batch Job
description: Batch Job endpoints that allow handling batch jobs in Medusa.
x-resourceId: batch_job
- name: Claim
- name: Claim
description: Claim endpoints that allow handling claims in Medusa.
x-resourceId: claim_order
- name: Collection
- name: Collection
description: Collection endpoints that allow handling collections in Medusa.
x-resourceId: product_collection
- name: Customer
- name: Customer
description: Customer endpoints that allow handling customers in Medusa.
x-resourceId: customer
- name: Customer Group
- name: Customer Group
description: Customer Group endpoints that allow handling customer groups in Medusa.
x-resourceId: customer_group
- name: Discount
- name: Discount
description: Discount endpoints that allow handling discounts in Medusa.
x-resourceId: discount
- name: Discount Condition
- name: Discount Condition
description: Discount Condition endpoints that allow handling discount conditions
in Medusa.
x-resourceId: discount_condition
- name: Draft Order
- name: Draft Order
description: Draft Order endpoints that allow handling draft orders in Medusa.
x-resourceId: draft-order
- name: Gift Card
- name: Gift Card
description: Gift Card endpoints that allow handling gift cards in Medusa.
x-resourceId: gift_card
- name: Invite
- name: Invite
description: Invite endpoints that allow handling invites in Medusa.
x-resourceId: invite
- name: Note
- name: Note
description: Note endpoints that allow handling notes in Medusa.
x-resourceId: note
- name: Notification
- name: Notification
description: Notification endpoints that allow handling notifications in Medusa.
x-resourceId: notification
- name: Order
- name: Order
description: Order endpoints that allow handling orders in Medusa.
x-resourceId: order
- name: Price List
- name: Price List
description: Price List endpoints that allow handling price lists in Medusa.
x-resourceId: price_list
- name: Product
- name: Product
description: Product endpoints that allow handling products in Medusa.
x-resourceId: product
- name: Product Tag
- name: Product Tag
description: Product Tag endpoints that allow handling product tags in Medusa.
x-resourceId: product_tag
- name: Product Type
- name: Product Type
description: Product Types endpoints that allow handling product types in Medusa.
x-resourceId: product_type
- name: Product Variant
- name: Product Variant
description: Product Variant endpoints that allow handling product variants in Medusa.
x-resourceId: product_variant
- name: Region
- name: Region
description: Region endpoints that allow handling regions in Medusa.
x-resourceId: region
- name: Return Reason
- name: Return Reason
description: Return Reason endpoints that allow handling return reasons in Medusa.
x-resourceId: return_reason
- name: Return
- name: Return
description: Return endpoints that allow handling returns in Medusa.
x-resourceId: return
- name: Sales Channel
- name: Sales Channel
description: Sales Channel endpoints that allow handling sales channels in Medusa.
x-resourceId: sales_channel
- name: Shipping Option
- name: Shipping Option
description: Shipping Option endpoints that allow handling shipping options in Medusa.
x-resourceId: shipping_option
- name: Shipping Profile
- name: Shipping Profile
description: Shipping Profile endpoints that allow handling shipping profiles in
Medusa.
x-resourceId: shipping_profile
- name: Store
- name: Store
description: Store endpoints that allow handling stores in Medusa.
x-resourceId: store
- name: Swap
- name: Swap
description: Swap endpoints that allow handling swaps in Medusa.
x-resourceId: swap
- name: Tax Rate
- name: Tax Rate
description: Tax Rate endpoints that allow handling tax rates in Medusa.
x-resourceId: tax_rate
- name: Upload
- name: Upload
description: Upload endpoints that allow handling uploads in Medusa.
- name: User
- name: User
description: User endpoints that allow handling users in Medusa.
x-resourceId: user
servers:
- url: https://api.medusa-commerce.com/admin
paths: {}
- url: https://api.medusa-commerce.com/admin
paths: { }
components:
responses:
default_error:
@@ -159,7 +130,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$ref: "#/components/schemas/Error"
example:
code: "unknown_error"
message: "An unknown error occurred."
@@ -169,7 +140,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$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."
@@ -179,7 +150,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$ref: "#/components/schemas/Error"
example:
code: "invalid_request_error"
message: "Discount with code TEST already exists."
@@ -189,7 +160,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$ref: "#/components/schemas/Error"
example:
message: "Entity with id 1 was not found"
type: "not_found"
@@ -199,21 +170,21 @@ components:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/error"
- $ref: "#/components/schemas/multiple_errors"
- $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"
$ref: "#/components/schemas/Error"
examples:
database:
$ref: "#/components/examples/database_error"
+23 -35
View File
@@ -55,48 +55,36 @@ info:
name: MIT
url: https://github.com/medusajs/medusa/blob/master/LICENSE
tags:
- name: Auth
- name: Auth
description: Auth endpoints that allow authorization of customers and manages their
sessions.
- name: Cart
- name: Cart
description: Cart endpoints that allow handling carts in Medusa.
x-resourceId: cart
- name: Collection
- name: Collection
description: Collection endpoints that allow handling collections in Medusa.
x-resourceId: product_collection
- name: Customer
- name: Customer
description: Customer endpoints that allow handling customers in Medusa.
x-resourceId: customer
- name: Gift Card
- name: Gift Card
description: Gift Card endpoints that allow handling gift cards in Medusa.
x-resourceId: gift_card
- name: Order
- name: Order
description: Order endpoints that allow handling orders in Medusa.
x-resourceId: order
- name: Product
- name: Product
description: Product endpoints that allow handling products in Medusa.
x-resourceId: product
- name: Product Variant
- name: Product Variant
description: Product Variant endpoints that allow handling product variants in Medusa.
x-resourceId: product_variant
- name: Region
- name: Region
description: Region endpoints that allow handling regions in Medusa.
x-resourceId: region
- name: Return Reason
- name: Return Reason
description: Return Reason endpoints that allow handling return reasons in Medusa.
x-resourceId: return_reason
- name: Return
- name: Return
description: Return endpoints that allow handling returns in Medusa.
x-resourceId: return
- name: Shipping Option
- name: Shipping Option
description: Shipping Option endpoints that allow handling shipping options in Medusa.
x-resourceId: shipping_option
- name: Swap
- name: Swap
description: Swap endpoints that allow handling swaps in Medusa.
x-resourceId: swap
servers:
- url: https://api.medusa-commerce.com/store
paths: {}
- url: https://api.medusa-commerce.com/store
paths: { }
components:
responses:
default_error:
@@ -104,7 +92,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$ref: "#/components/schemas/Error"
example:
code: "unknown_error"
message: "An unknown error occurred."
@@ -114,7 +102,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$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."
@@ -124,7 +112,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$ref: "#/components/schemas/Error"
example:
code: "invalid_request_error"
message: "Discount with code TEST already exists."
@@ -134,7 +122,7 @@ components:
content:
application/json:
schema:
$ref: "#/components/schemas/error"
$ref: "#/components/schemas/Error"
example:
message: "Entity with id 1 was not found"
type: "not_found"
@@ -144,21 +132,21 @@ components:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/error"
- $ref: "#/components/schemas/multiple_errors"
- $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"
$ref: "#/components/schemas/Error"
examples:
database:
$ref: "#/components/examples/database_error"
@@ -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"
@@ -79,9 +79,8 @@ export default () => {
}
/**
* @schema error
* @schema Error
* title: "Response Error"
* x-resourceId: error
* type: object
* properties:
* code:
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
@@ -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":
Loaded 100 of 319 files, more files were not shown because too many files have changed in this diff. Show more