diff --git a/.changeset/witty-pigs-rescue.md b/.changeset/witty-pigs-rescue.md new file mode 100644 index 0000000000..f585cc01e9 --- /dev/null +++ b/.changeset/witty-pigs-rescue.md @@ -0,0 +1,5 @@ +--- +"@medusajs/medusa": patch +--- + +feat(oas): identify required fields in responses - admin diff --git a/packages/medusa/src/api/routes/admin/apps/index.ts b/packages/medusa/src/api/routes/admin/apps/index.ts index 2068a770de..8b45a04f8e 100644 --- a/packages/medusa/src/api/routes/admin/apps/index.ts +++ b/packages/medusa/src/api/routes/admin/apps/index.ts @@ -19,6 +19,8 @@ export default (app) => { /** * @schema AdminAppsRes * type: object + * required: + * - apps * properties: * apps: * $ref: "#/components/schemas/OAuth" @@ -30,6 +32,8 @@ export type AdminAppsRes = { /** * @schema AdminAppsListRes * type: object + * required: + * - apps * properties: * apps: * type: array diff --git a/packages/medusa/src/api/routes/admin/auth/index.ts b/packages/medusa/src/api/routes/admin/auth/index.ts index 272aeb81f3..5c8cc0bc3f 100644 --- a/packages/medusa/src/api/routes/admin/auth/index.ts +++ b/packages/medusa/src/api/routes/admin/auth/index.ts @@ -26,6 +26,8 @@ export default (app) => { /** * @schema AdminAuthRes * type: object + * required: + * - user * properties: * user: * $ref: "#/components/schemas/User" diff --git a/packages/medusa/src/api/routes/admin/batch/index.ts b/packages/medusa/src/api/routes/admin/batch/index.ts index d408023f91..00ac1d10ba 100644 --- a/packages/medusa/src/api/routes/admin/batch/index.ts +++ b/packages/medusa/src/api/routes/admin/batch/index.ts @@ -1,6 +1,6 @@ import { Router } from "express" import { BatchJob } from "../../../.." -import { DeleteResponse, PaginatedResponse } from "../../../../types/common" +import { PaginatedResponse } from "../../../../types/common" import middlewares, { canAccessBatchJob, getRequestedBatchJob, @@ -45,6 +45,8 @@ export default (app) => { /** * @schema AdminBatchJobRes * type: object + * required: + * - batch_job * properties: * batch_job: * $ref: "#/components/schemas/BatchJob" @@ -56,6 +58,11 @@ export type AdminBatchJobRes = { /** * @schema AdminBatchJobListRes * type: object + * required: + * - batch_jobs + * - count + * - offset + * - limit * properties: * batch_jobs: * type: array diff --git a/packages/medusa/src/api/routes/admin/collections/index.ts b/packages/medusa/src/api/routes/admin/collections/index.ts index 60fcfbb504..b536b144a5 100644 --- a/packages/medusa/src/api/routes/admin/collections/index.ts +++ b/packages/medusa/src/api/routes/admin/collections/index.ts @@ -72,6 +72,11 @@ export const defaultAdminCollectionsRelations = ["products"] /** * @schema AdminCollectionsListRes * type: object + * required: + * - collections + * - count + * - offset + * - limit * properties: * collections: * type: array @@ -94,6 +99,10 @@ export type AdminCollectionsListRes = PaginatedResponse & { /** * @schema AdminCollectionsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -112,6 +121,10 @@ export type AdminCollectionsDeleteRes = DeleteResponse /** * @schema AdminDeleteProductsFromCollectionRes * type: object + * required: + * - id + * - object + * - removed_products * properties: * id: * type: string @@ -136,6 +149,8 @@ export type AdminDeleteProductsFromCollectionRes = { /** * @schema AdminCollectionsRes * type: object + * required: + * - collection * properties: * collection: * $ref: "#/components/schemas/ProductCollection" diff --git a/packages/medusa/src/api/routes/admin/currencies/index.ts b/packages/medusa/src/api/routes/admin/currencies/index.ts index 8d7d342daf..c5c0b1657e 100644 --- a/packages/medusa/src/api/routes/admin/currencies/index.ts +++ b/packages/medusa/src/api/routes/admin/currencies/index.ts @@ -35,6 +35,11 @@ export default (app) => { /** * @schema AdminCurrenciesListRes * type: object + * required: + * - currencies + * - count + * - offset + * - limit * properties: * currencies: * type: array @@ -57,6 +62,8 @@ export type AdminCurrenciesListRes = PaginatedResponse & { /** * @schema AdminCurrenciesRes * type: object + * required: + * - currency * properties: * currency: * $ref: "#/components/schemas/Currency" diff --git a/packages/medusa/src/api/routes/admin/customer-groups/index.ts b/packages/medusa/src/api/routes/admin/customer-groups/index.ts index 5c26a6e794..ad03e4f4c5 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/index.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/index.ts @@ -59,6 +59,8 @@ export default (app) => { /** * @schema AdminCustomerGroupsRes * type: object + * required: + * - customer_group * properties: * customer_group: * $ref: "#/components/schemas/CustomerGroup" @@ -70,6 +72,10 @@ export type AdminCustomerGroupsRes = { /** * @schema AdminCustomerGroupsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -88,6 +94,11 @@ export type AdminCustomerGroupsDeleteRes = DeleteResponse /** * @schema AdminCustomerGroupsListRes * type: object + * required: + * - customer_groups + * - count + * - offset + * - limit * properties: * customer_groups: * type: array diff --git a/packages/medusa/src/api/routes/admin/customers/index.ts b/packages/medusa/src/api/routes/admin/customers/index.ts index 92e41865e3..dd92fae787 100644 --- a/packages/medusa/src/api/routes/admin/customers/index.ts +++ b/packages/medusa/src/api/routes/admin/customers/index.ts @@ -23,6 +23,8 @@ export default (app) => { /** * @schema AdminCustomersRes * type: object + * required: + * - customer * properties: * customer: * $ref: "#/components/schemas/Customer" @@ -34,6 +36,11 @@ export type AdminCustomersRes = { /** * @schema AdminCustomersListRes * type: object + * required: + * - customers + * - count + * - offset + * - limit * properties: * customers: * type: array diff --git a/packages/medusa/src/api/routes/admin/discounts/index.ts b/packages/medusa/src/api/routes/admin/discounts/index.ts index 890a010db9..866d3c48ef 100644 --- a/packages/medusa/src/api/routes/admin/discounts/index.ts +++ b/packages/medusa/src/api/routes/admin/discounts/index.ts @@ -223,6 +223,8 @@ export const defaultAdminDiscountConditionRelations = ["discount_rule"] /** * @schema AdminDiscountsRes * type: object + * required: + * - discount * properties: * discount: * $ref: "#/components/schemas/Discount" @@ -234,6 +236,8 @@ export type AdminDiscountsRes = { /** * @schema AdminDiscountConditionsRes * type: object + * required: + * - discount_condition * properties: * discount_condition: * $ref: "#/components/schemas/DiscountCondition" @@ -245,6 +249,10 @@ export type AdminDiscountConditionsRes = { /** * @schema AdminDiscountsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -263,6 +271,11 @@ export type AdminDiscountsDeleteRes = DeleteResponse /** * @schema AdminDiscountConditionsDeleteRes * type: object + * required: + * - id + * - object + * - deleted + * - discount * properties: * id: * type: string @@ -286,6 +299,11 @@ export type AdminDiscountConditionsDeleteRes = DeleteResponse & { /** * @schema AdminDiscountsListRes * type: object + * required: + * - discounts + * - count + * - offset + * - limit * properties: * discounts: * type: array diff --git a/packages/medusa/src/api/routes/admin/draft-orders/index.ts b/packages/medusa/src/api/routes/admin/draft-orders/index.ts index e518b20322..a02f7f74da 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/index.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/index.ts @@ -94,6 +94,8 @@ export const defaultAdminDraftOrdersFields: (keyof DraftOrder)[] = [ /** * @schema AdminPostDraftOrdersDraftOrderRegisterPaymentRes * type: object + * required: + * - order * properties: * order: * $ref: "#/components/schemas/Order" @@ -105,6 +107,8 @@ export type AdminPostDraftOrdersDraftOrderRegisterPaymentRes = { /** * @schema AdminDraftOrdersRes * type: object + * required: + * - draft_order * properties: * draft_order: * $ref: "#/components/schemas/DraftOrder" @@ -116,6 +120,10 @@ export type AdminDraftOrdersRes = { /** * @schema AdminDraftOrdersDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -134,6 +142,11 @@ export type AdminDraftOrdersDeleteRes = DeleteResponse /** * @schema AdminDraftOrdersListRes * type: object + * required: + * - draft_orders + * - count + * - offset + * - limit * properties: * draft_orders: * type: array diff --git a/packages/medusa/src/api/routes/admin/gift-cards/index.ts b/packages/medusa/src/api/routes/admin/gift-cards/index.ts index bba23875ef..92b8f757d3 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/index.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/index.ts @@ -59,6 +59,8 @@ export const defaultAdminGiftCardRelations = ["region", "order"] /** * @schema AdminGiftCardsRes * type: object + * required: + * - gift_card * properties: * gift_card: * $ref: "#/components/schemas/GiftCard" @@ -70,6 +72,10 @@ export type AdminGiftCardsRes = { /** * @schema AdminGiftCardsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -88,6 +94,11 @@ export type AdminGiftCardsDeleteRes = DeleteResponse /** * @schema AdminGiftCardsListRes * type: object + * required: + * - gift_cards + * - count + * - offset + * - limit * properties: * gift_cards: * type: array diff --git a/packages/medusa/src/api/routes/admin/inventory-items/index.ts b/packages/medusa/src/api/routes/admin/inventory-items/index.ts index 40ac0023fa..4b61c251e3 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/index.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/index.ts @@ -14,12 +14,12 @@ import { AdminGetInventoryItemsItemParams } from "./get-inventory-item" import { AdminPostInventoryItemsInventoryItemReq } from "./update-inventory-item" import { AdminGetInventoryItemsItemLocationLevelsParams } from "./list-location-levels" import { - AdminPostInventoryItemsItemLocationLevelsReq, AdminPostInventoryItemsItemLocationLevelsParams, + AdminPostInventoryItemsItemLocationLevelsReq, } from "./create-location-level" import { - AdminPostInventoryItemsItemLocationLevelsLevelReq, AdminPostInventoryItemsItemLocationLevelsLevelParams, + AdminPostInventoryItemsItemLocationLevelsLevelReq, } from "./update-location-level" import { checkRegisteredModules } from "../../../middlewares/check-registered-modules" import { ProductVariant } from "../../../../models" @@ -134,6 +134,8 @@ export const defaultAdminInventoryItemRelations = [] /** * @schema AdminInventoryItemsRes * type: object + * required: + * - inventory_item * properties: * inventory_item: * $ref: "#/components/schemas/InventoryItemDTO" @@ -145,6 +147,10 @@ export type AdminInventoryItemsRes = { /** * @schema AdminInventoryItemsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -163,6 +169,11 @@ export type AdminInventoryItemsDeleteRes = DeleteResponse /** * @schema AdminInventoryItemsListRes * type: object + * required: + * - inventory_items + * - count + * - offset + * - limit * properties: * inventory_items: * type: array @@ -185,6 +196,11 @@ export type AdminInventoryItemsListRes = PaginatedResponse & { /** * @schema AdminInventoryItemsListWithVariantsAndLocationLevelsRes * type: object + * required: + * - inventory_items + * - count + * - offset + * - limit * properties: * inventory_items: * type: array @@ -222,14 +238,22 @@ export type AdminInventoryItemsListWithVariantsAndLocationLevelsRes = /** * @schema AdminInventoryItemsLocationLevelsRes * type: object + * required: + * - inventory_item * properties: - * id: - * description: The id of the location - * location_levels: - * description: List of stock levels at a given location - * type: array - * items: - * $ref: "#/components/schemas/InventoryLevelDTO" + * inventory_item: + * type: object + * required: + * - id + * - location_levels + * properties: + * id: + * description: The id of the location + * location_levels: + * description: List of stock levels at a given location + * type: array + * items: + * $ref: "#/components/schemas/InventoryLevelDTO" */ export type AdminInventoryItemsLocationLevelsRes = { inventory_item: { diff --git a/packages/medusa/src/api/routes/admin/invites/index.ts b/packages/medusa/src/api/routes/admin/invites/index.ts index 74581b0057..286e0bdd81 100644 --- a/packages/medusa/src/api/routes/admin/invites/index.ts +++ b/packages/medusa/src/api/routes/admin/invites/index.ts @@ -35,6 +35,10 @@ export default (app) => { /** * @schema AdminInviteDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -53,6 +57,8 @@ export type AdminInviteDeleteRes = DeleteResponse /** * @schema AdminListInvitesRes * type: object + * required: + * - invites * properties: * invites: * type: array diff --git a/packages/medusa/src/api/routes/admin/notes/index.ts b/packages/medusa/src/api/routes/admin/notes/index.ts index dec875734f..0e77df3d66 100644 --- a/packages/medusa/src/api/routes/admin/notes/index.ts +++ b/packages/medusa/src/api/routes/admin/notes/index.ts @@ -25,6 +25,8 @@ export default (app) => { /** * @schema AdminNotesRes * type: object + * required: + * - note * properties: * note: * $ref: "#/components/schemas/Note" @@ -36,6 +38,10 @@ export type AdminNotesRes = { /** * @schema AdminNotesDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -54,6 +60,11 @@ export type AdminNotesDeleteRes = DeleteResponse /** * @schema AdminNotesListRes * type: object + * required: + * - notes + * - count + * - offset + * - limit * properties: * notes: * type: array diff --git a/packages/medusa/src/api/routes/admin/notifications/index.ts b/packages/medusa/src/api/routes/admin/notifications/index.ts index beafbd8fd0..c00624f7ba 100644 --- a/packages/medusa/src/api/routes/admin/notifications/index.ts +++ b/packages/medusa/src/api/routes/admin/notifications/index.ts @@ -39,6 +39,8 @@ export const defaultAdminNotificationsFields = [ /** * @schema AdminNotificationsListRes * type: object + * required: + * - notifications * properties: * notifications: * type: array @@ -52,6 +54,8 @@ export type AdminNotificationsListRes = { /** * @schema AdminNotificationsRes * type: object + * required: + * - notification * properties: * notification: * $ref: "#/components/schemas/Notification" diff --git a/packages/medusa/src/api/routes/admin/order-edits/index.ts b/packages/medusa/src/api/routes/admin/order-edits/index.ts index 0dd8300f2c..72614e6897 100644 --- a/packages/medusa/src/api/routes/admin/order-edits/index.ts +++ b/packages/medusa/src/api/routes/admin/order-edits/index.ts @@ -101,6 +101,8 @@ export default (app) => { /** * @schema AdminOrderEditsRes * type: object + * required: + * - order_edit * properties: * order_edit: * $ref: "#/components/schemas/OrderEdit" @@ -112,6 +114,11 @@ export type AdminOrderEditsRes = { /** * @schema AdminOrderEditsListRes * type: object + * required: + * - order_edits + * - count + * - offset + * - limit * properties: * order_edits: * type: array @@ -134,6 +141,10 @@ export type AdminOrderEditsListRes = PaginatedResponse & { /** * @schema AdminOrderEditDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -152,6 +163,10 @@ export type AdminOrderEditDeleteRes = DeleteResponse /** * @schema AdminOrderEditItemChangeDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string diff --git a/packages/medusa/src/api/routes/admin/orders/index.ts b/packages/medusa/src/api/routes/admin/orders/index.ts index d99822b2f8..16642f31f6 100644 --- a/packages/medusa/src/api/routes/admin/orders/index.ts +++ b/packages/medusa/src/api/routes/admin/orders/index.ts @@ -264,6 +264,8 @@ export default (app, featureFlagRouter: FlagRouter) => { /** * @schema AdminOrdersRes * type: object + * required: + * - order * properties: * order: * $ref: "#/components/schemas/Order" @@ -275,6 +277,11 @@ export type AdminOrdersRes = { /** * @schema AdminOrdersListRes * type: object + * required: + * - orders + * - count + * - offset + * - limit * properties: * orders: * type: array diff --git a/packages/medusa/src/api/routes/admin/payment-collections/index.ts b/packages/medusa/src/api/routes/admin/payment-collections/index.ts index e1374e7f74..9d86ae6dfc 100644 --- a/packages/medusa/src/api/routes/admin/payment-collections/index.ts +++ b/packages/medusa/src/api/routes/admin/payment-collections/index.ts @@ -65,6 +65,8 @@ export const defaulPaymentCollectionRelations = [ /** * @schema AdminPaymentCollectionsRes * type: object + * required: + * - payment_collection * properties: * payment_collection: * $ref: "#/components/schemas/PaymentCollection" @@ -76,6 +78,10 @@ export type AdminPaymentCollectionsRes = { /** * @schema AdminPaymentCollectionDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string diff --git a/packages/medusa/src/api/routes/admin/payments/index.ts b/packages/medusa/src/api/routes/admin/payments/index.ts index 819195f886..8beb979582 100644 --- a/packages/medusa/src/api/routes/admin/payments/index.ts +++ b/packages/medusa/src/api/routes/admin/payments/index.ts @@ -55,6 +55,8 @@ export const defaultPaymentFields = [ /** * @schema AdminPaymentRes * type: object + * required: + * - payment * properties: * payment: * $ref: "#/components/schemas/Payment" @@ -66,6 +68,8 @@ export type AdminPaymentRes = { /** * @schema AdminRefundRes * type: object + * required: + * - refund * properties: * refund: * $ref: "#/components/schemas/Refund" diff --git a/packages/medusa/src/api/routes/admin/price-lists/index.ts b/packages/medusa/src/api/routes/admin/price-lists/index.ts index 7b17c86365..800678b6e0 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/index.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/index.ts @@ -96,6 +96,8 @@ export const defaultAdminPriceListRelations = ["prices", "customer_groups"] /** * @schema AdminPriceListRes * type: object + * required: + * - price_list * properties: * price_list: * $ref: "#/components/schemas/PriceList" @@ -107,6 +109,10 @@ export type AdminPriceListRes = { /** * @schema AdminPriceListDeleteBatchRes * type: object + * required: + * - ids + * - object + * - deleted * properties: * ids: * type: array @@ -131,6 +137,10 @@ export type AdminPriceListDeleteBatchRes = { /** * @schema AdminPriceListDeleteProductPricesRes * type: object + * required: + * - ids + * - object + * - deleted * properties: * ids: * type: array @@ -151,6 +161,10 @@ export type AdminPriceListDeleteProductPricesRes = AdminPriceListDeleteBatchRes /** * @schema AdminPriceListDeleteVariantPricesRes * type: object + * required: + * - ids + * - object + * - deleted * properties: * ids: * type: array @@ -171,6 +185,10 @@ export type AdminPriceListDeleteVariantPricesRes = AdminPriceListDeleteBatchRes /** * @schema AdminPriceListDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -189,6 +207,11 @@ export type AdminPriceListDeleteRes = DeleteResponse /** * @schema AdminPriceListsListRes * type: object + * required: + * - price_lists + * - count + * - offset + * - limit * properties: * price_lists: * type: array @@ -211,6 +234,11 @@ export type AdminPriceListsListRes = PaginatedResponse & { /** * @schema AdminPriceListsProductsListRes * type: object + * required: + * - products + * - count + * - offset + * - limit * properties: * products: * type: array diff --git a/packages/medusa/src/api/routes/admin/product-categories/index.ts b/packages/medusa/src/api/routes/admin/product-categories/index.ts index f598dbdd94..e8ca98281a 100644 --- a/packages/medusa/src/api/routes/admin/product-categories/index.ts +++ b/packages/medusa/src/api/routes/admin/product-categories/index.ts @@ -1,8 +1,8 @@ import { Router } from "express" import middlewares, { - transformQuery, transformBody, + transformQuery, } from "../../../middlewares" import { DeleteResponse, PaginatedResponse } from "../../../../types/common" @@ -19,23 +19,23 @@ import listProductCategories, { } from "./list-product-categories" import createProductCategory, { - AdminPostProductCategoriesReq, AdminPostProductCategoriesParams, + AdminPostProductCategoriesReq, } from "./create-product-category" import updateProductCategory, { - AdminPostProductCategoriesCategoryReq, AdminPostProductCategoriesCategoryParams, + AdminPostProductCategoriesCategoryReq, } from "./update-product-category" import addProductsBatch, { - AdminPostProductCategoriesCategoryProductsBatchReq, AdminPostProductCategoriesCategoryProductsBatchParams, + AdminPostProductCategoriesCategoryProductsBatchReq, } from "./add-products-batch" import deleteProductsBatch, { - AdminDeleteProductCategoriesCategoryProductsBatchReq, AdminDeleteProductCategoriesCategoryProductsBatchParams, + AdminDeleteProductCategoriesCategoryProductsBatchReq, } from "./delete-products-batch" import { ProductCategory } from "../../../../models" @@ -152,6 +152,8 @@ export const defaultProductCategoryFields = [ /** * @schema AdminProductCategoriesCategoryRes * type: object + * required: + * - product_category * properties: * product_category: * $ref: "#/components/schemas/ProductCategory" @@ -163,6 +165,10 @@ export type AdminProductCategoriesCategoryRes = { /** * @schema AdminProductCategoriesCategoryDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -181,6 +187,11 @@ export type AdminProductCategoriesCategoryDeleteRes = DeleteResponse /** * @schema AdminProductCategoriesListRes * type: object + * required: + * - product_categories + * - count + * - offset + * - limit * properties: * product_categories: * type: array diff --git a/packages/medusa/src/api/routes/admin/product-tags/index.ts b/packages/medusa/src/api/routes/admin/product-tags/index.ts index 59e34076f9..795fb93642 100644 --- a/packages/medusa/src/api/routes/admin/product-tags/index.ts +++ b/packages/medusa/src/api/routes/admin/product-tags/index.ts @@ -34,6 +34,11 @@ export const defaultAdminProductTagsRelations = [] /** * @schema AdminProductTagsListRes * type: object + * required: + * - product_tags + * - count + * - offset + * - limit * properties: * product_tags: * type: array diff --git a/packages/medusa/src/api/routes/admin/product-types/index.ts b/packages/medusa/src/api/routes/admin/product-types/index.ts index 9434e20be1..57efbf1936 100644 --- a/packages/medusa/src/api/routes/admin/product-types/index.ts +++ b/packages/medusa/src/api/routes/admin/product-types/index.ts @@ -34,6 +34,11 @@ export const defaultAdminProductTypeRelations = [] /** * @schema AdminProductTypesListRes * type: object + * required: + * - product_types + * - count + * - offset + * - limit * properties: * product_types: * type: array diff --git a/packages/medusa/src/api/routes/admin/products/index.ts b/packages/medusa/src/api/routes/admin/products/index.ts index e1fce0db36..28279807d1 100644 --- a/packages/medusa/src/api/routes/admin/products/index.ts +++ b/packages/medusa/src/api/routes/admin/products/index.ts @@ -136,6 +136,11 @@ export const defaultAdminGetProductsVariantsFields = ["id", "product_id"] /** * @schema AdminProductsDeleteOptionRes * type: object + * required: + * - option_id + * - object + * - deleted + * - product * properties: * option_id: * type: string @@ -161,6 +166,11 @@ export type AdminProductsDeleteOptionRes = { /** * @schema AdminProductsDeleteVariantRes * type: object + * required: + * - variant_id + * - object + * - deleted + * - product * properties: * variant_id: * type: string @@ -186,6 +196,10 @@ export type AdminProductsDeleteVariantRes = { /** * @schema AdminProductsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -208,6 +222,11 @@ export type AdminProductsDeleteRes = { /** * @schema AdminProductsListRes * type: object + * required: + * - products + * - count + * - offset + * - limit * properties: * products: * type: array @@ -232,6 +251,11 @@ export type AdminProductsListRes = PaginatedResponse & { /** * @schema AdminProductsListVariantsRes * type: object + * required: + * - variants + * - count + * - offset + * - limit * properties: * variants: * type: array @@ -254,6 +278,8 @@ export type AdminProductsListVariantsRes = PaginatedResponse & { /** * @schema AdminProductsListTypesRes * type: object + * required: + * - types * properties: * types: * type: array @@ -267,11 +293,17 @@ export type AdminProductsListTypesRes = { /** * @schema AdminProductsListTagsRes * type: object + * required: + * - tags * properties: * tags: * type: array * items: * type: object + * required: + * - id + * - usage_count + * - value * properties: * id: * description: The ID of the tag. @@ -294,6 +326,8 @@ export type AdminProductsListTagsRes = { /** * @schema AdminProductsRes * type: object + * required: + * - product * properties: * product: * $ref: "#/components/schemas/Product" diff --git a/packages/medusa/src/api/routes/admin/publishable-api-keys/index.ts b/packages/medusa/src/api/routes/admin/publishable-api-keys/index.ts index 5cfb5938e2..8d3343b2c7 100644 --- a/packages/medusa/src/api/routes/admin/publishable-api-keys/index.ts +++ b/packages/medusa/src/api/routes/admin/publishable-api-keys/index.ts @@ -83,6 +83,8 @@ export default (app) => { /** * @schema AdminPublishableApiKeysRes * type: object + * required: + * - publishable_api_key * properties: * publishable_api_key: * $ref: "#/components/schemas/PublishableApiKey" @@ -94,6 +96,11 @@ export type AdminPublishableApiKeysRes = { /** * @schema AdminPublishableApiKeysListRes * type: object + * required: + * - publishable_api_keys + * - count + * - offset + * - limit * properties: * publishable_api_keys: * type: array @@ -116,6 +123,10 @@ export type AdminPublishableApiKeysListRes = PaginatedResponse & { /** * @schema AdminPublishableApiKeyDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -134,6 +145,8 @@ export type AdminPublishableApiKeyDeleteRes = DeleteResponse /** * @schema AdminPublishableApiKeysListSalesChannelsRes * type: object + * required: + * - sales_channels * properties: * sales_channels: * type: array diff --git a/packages/medusa/src/api/routes/admin/regions/index.ts b/packages/medusa/src/api/routes/admin/regions/index.ts index 6ae554cc9d..e9ddc218d8 100644 --- a/packages/medusa/src/api/routes/admin/regions/index.ts +++ b/packages/medusa/src/api/routes/admin/regions/index.ts @@ -88,6 +88,8 @@ export const defaultAdminRegionRelations = [ /** * @schema AdminRegionsRes * type: object + * required: + * - region * properties: * region: * $ref: "#/components/schemas/Region" @@ -99,6 +101,11 @@ export class AdminRegionsRes { /** * @schema AdminRegionsListRes * type: object + * required: + * - regions + * - count + * - offset + * - limit * properties: * regions: * type: array @@ -121,6 +128,10 @@ export type AdminRegionsListRes = PaginatedResponse & { /** * @schema AdminRegionsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -144,22 +155,29 @@ export class FulfillmentOption { /** * @schema AdminGetRegionsRegionFulfillmentOptionsRes * type: object + * required: + * - fulfillment_options * properties: * fulfillment_options: * type: array * items: * type: object + * required: + * - provider_id + * - options * properties: * provider_id: - * type: string * description: ID of the fulfillment provider + * type: string * options: - * type: array * description: fulfillment provider options - * example: - * - id: "manual-fulfillment" - * - id: "manual-fulfillment-return" - * is_return: true + * type: array + * items: + * type: object + * example: + * - id: "manual-fulfillment" + * - id: "manual-fulfillment-return" + * is_return: true */ export class AdminGetRegionsRegionFulfillmentOptionsRes { fulfillment_options: FulfillmentOption[] diff --git a/packages/medusa/src/api/routes/admin/reservations/index.ts b/packages/medusa/src/api/routes/admin/reservations/index.ts index 77ff14803e..44a6aa1226 100644 --- a/packages/medusa/src/api/routes/admin/reservations/index.ts +++ b/packages/medusa/src/api/routes/admin/reservations/index.ts @@ -1,5 +1,5 @@ import { Router } from "express" -import { Note, ReservationItemDTO } from "../../../.." +import { ReservationItemDTO } from "../../../.." import { DeleteResponse, PaginatedResponse } from "../../../../types/common" import middlewares, { transformBody, @@ -71,6 +71,11 @@ export type AdminReservationsRes = { /** * @schema AdminGetReservationReservationsReq * type: object + * required: + * - reservations + * - count + * - offset + * - limit * properties: * reservations: * type: array diff --git a/packages/medusa/src/api/routes/admin/return-reasons/index.ts b/packages/medusa/src/api/routes/admin/return-reasons/index.ts index 19265fa594..902853c00a 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/index.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/index.ts @@ -55,6 +55,8 @@ export const defaultAdminReturnReasonsRelations: (keyof ReturnReason)[] = [ /** * @schema AdminReturnReasonsRes * type: object + * required: + * - return_reason * properties: * return_reason: * $ref: "#/components/schemas/ReturnReason" @@ -66,6 +68,8 @@ export type AdminReturnReasonsRes = { /** * @schema AdminReturnReasonsListRes * type: object + * required: + * - return_reasons * properties: * return_reasons: * type: array @@ -79,6 +83,10 @@ export type AdminReturnReasonsListRes = { /** * @schema AdminReturnReasonsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string diff --git a/packages/medusa/src/api/routes/admin/returns/index.ts b/packages/medusa/src/api/routes/admin/returns/index.ts index 0bc850c588..d74433e15a 100644 --- a/packages/medusa/src/api/routes/admin/returns/index.ts +++ b/packages/medusa/src/api/routes/admin/returns/index.ts @@ -30,6 +30,8 @@ export default (app) => { /** * @schema AdminReturnsCancelRes * type: object + * required: + * - order * properties: * order: * $ref: "#/components/schemas/Order" @@ -41,6 +43,11 @@ export type AdminReturnsCancelRes = { /** * @schema AdminReturnsListRes * type: object + * required: + * - returns + * - count + * - offset + * - limit * properties: * returns: * type: array @@ -63,6 +70,8 @@ export type AdminReturnsListRes = PaginatedResponse & { /** * @schema AdminReturnsRes * type: object + * required: + * - return * properties: * return: * $ref: "#/components/schemas/Return" diff --git a/packages/medusa/src/api/routes/admin/sales-channels/index.ts b/packages/medusa/src/api/routes/admin/sales-channels/index.ts index 29741c1e50..58a4fa680f 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/index.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/index.ts @@ -88,6 +88,8 @@ export default (app) => { /** * @schema AdminSalesChannelsRes * type: object + * required: + * - sales_channel * properties: * sales_channel: * $ref: "#/components/schemas/SalesChannel" @@ -99,6 +101,10 @@ export type AdminSalesChannelsRes = { /** * @schema AdminSalesChannelsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -117,6 +123,10 @@ export type AdminSalesChannelsDeleteRes = DeleteResponse /** * @schema AdminSalesChannelsDeleteLocationRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -135,6 +145,11 @@ export type AdminSalesChannelsDeleteLocationRes = DeleteResponse /** * @schema AdminSalesChannelsListRes * type: object + * required: + * - sales_channels + * - count + * - offset + * - limit * properties: * sales_channels: * type: array diff --git a/packages/medusa/src/api/routes/admin/shipping-options/index.ts b/packages/medusa/src/api/routes/admin/shipping-options/index.ts index fe9af380c4..222798dc75 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/index.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/index.ts @@ -55,6 +55,11 @@ export const defaultRelations = ["region", "profile", "requirements"] /** * @schema AdminShippingOptionsListRes * type: object + * required: + * - shipping_options + * - count + * - offset + * - limit * properties: * shipping_options: * type: array @@ -63,6 +68,12 @@ export const defaultRelations = ["region", "profile", "requirements"] * count: * type: integer * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export type AdminShippingOptionsListRes = PaginatedResponse & { shipping_options: ShippingOption[] @@ -71,6 +82,8 @@ export type AdminShippingOptionsListRes = PaginatedResponse & { /** * @schema AdminShippingOptionsRes * type: object + * required: + * - shipping_option * properties: * shipping_option: * $ref: "#/components/schemas/ShippingOption" @@ -82,6 +95,10 @@ export type AdminShippingOptionsRes = { /** * @schema AdminShippingOptionsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/index.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/index.ts index 96225d86a6..0f7f986278 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/index.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/index.ts @@ -47,6 +47,10 @@ export const defaultAdminShippingProfilesRelations: (keyof ShippingProfile)[] = /** * @schema AdminDeleteShippingProfileRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -65,6 +69,8 @@ export type AdminDeleteShippingProfileRes = DeleteResponse /** * @schema AdminShippingProfilesRes * type: object + * required: + * - shipping_profile * properties: * shipping_profile: * $ref: "#/components/schemas/ShippingProfile" @@ -76,6 +82,8 @@ export type AdminShippingProfilesRes = { /** * @schema AdminShippingProfilesListRes * type: object + * required: + * - shipping_profiles * properties: * shipping_profiles: * type: array diff --git a/packages/medusa/src/api/routes/admin/stock-locations/index.ts b/packages/medusa/src/api/routes/admin/stock-locations/index.ts index fb4724d648..ae36c7161c 100644 --- a/packages/medusa/src/api/routes/admin/stock-locations/index.ts +++ b/packages/medusa/src/api/routes/admin/stock-locations/index.ts @@ -96,6 +96,10 @@ export const defaultAdminStockLocationRelations = [] /** * @schema AdminStockLocationsDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -114,6 +118,8 @@ export type AdminStockLocationsDeleteRes = DeleteResponse /** * @schema AdminStockLocationsRes * type: object + * required: + * - stock_location * properties: * stock_location: * $ref: "#/components/schemas/StockLocationExpandedDTO" @@ -125,6 +131,11 @@ export type AdminStockLocationsRes = { /** * @schema AdminStockLocationsListRes * type: object + * required: + * - stock_locations + * - count + * - offset + * - limit * properties: * stock_locations: * type: array diff --git a/packages/medusa/src/api/routes/admin/store/index.ts b/packages/medusa/src/api/routes/admin/store/index.ts index ced7f414d0..45f5639a05 100644 --- a/packages/medusa/src/api/routes/admin/store/index.ts +++ b/packages/medusa/src/api/routes/admin/store/index.ts @@ -33,6 +33,8 @@ export default (app) => { /** * @schema AdminStoresRes * type: object + * required: + * - store * properties: * store: * $ref: "#/components/schemas/ExtendedStoreDTO" @@ -44,6 +46,8 @@ export type AdminStoresRes = { /** * @schema AdminTaxProvidersList * type: object + * required: + * - tax_providers * properties: * tax_providers: * type: array @@ -57,6 +61,8 @@ export type AdminTaxProvidersList = { /** * @schema AdminPaymentProvidersList * type: object + * required: + * - payment_providers * properties: * payment_providers: * type: array diff --git a/packages/medusa/src/api/routes/admin/swaps/index.ts b/packages/medusa/src/api/routes/admin/swaps/index.ts index f017caa67c..74461ede6a 100644 --- a/packages/medusa/src/api/routes/admin/swaps/index.ts +++ b/packages/medusa/src/api/routes/admin/swaps/index.ts @@ -57,6 +57,11 @@ export const defaultAdminSwapFields = [ /** * @schema AdminSwapsListRes * type: object + * required: + * - swaps + * - count + * - offset + * - limit * properties: * swaps: * type: array @@ -79,6 +84,8 @@ export type AdminSwapsListRes = PaginatedResponse & { /** * @schema AdminSwapsRes * type: object + * required: + * - swap * properties: * swap: * $ref: "#/components/schemas/Swap" diff --git a/packages/medusa/src/api/routes/admin/tax-rates/index.ts b/packages/medusa/src/api/routes/admin/tax-rates/index.ts index 56bf3459cb..fdc6729743 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/index.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/index.ts @@ -99,6 +99,10 @@ export const defaultAdminTaxRatesFields: (keyof TaxRate)[] = [ /** * @schema AdminTaxRatesDeleteRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -117,6 +121,11 @@ export type AdminTaxRatesDeleteRes = DeleteResponse /** * @schema AdminTaxRatesListRes * type: object + * required: + * - tax_rates + * - count + * - offset + * - limit * properties: * tax_rates: * type: array @@ -139,6 +148,8 @@ export type AdminTaxRatesListRes = PaginatedResponse & { /** * @schema AdminTaxRatesRes * type: object + * required: + * - tax_rate * properties: * tax_rate: * $ref: "#/components/schemas/TaxRate" diff --git a/packages/medusa/src/api/routes/admin/uploads/index.ts b/packages/medusa/src/api/routes/admin/uploads/index.ts index 4766f1176c..05b97d21a2 100644 --- a/packages/medusa/src/api/routes/admin/uploads/index.ts +++ b/packages/medusa/src/api/routes/admin/uploads/index.ts @@ -42,15 +42,19 @@ export default (app) => { /** * @schema AdminUploadsRes * type: object + * required: + * - uploads * properties: * uploads: * type: array * items: * type: object + * required: + * - url * properties: * url: - * type: string * description: The URL of the uploaded file. + * type: string * format: uri */ export type AdminUploadsRes = { @@ -60,6 +64,10 @@ export type AdminUploadsRes = { /** * @schema AdminDeleteUploadsRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string @@ -78,10 +86,12 @@ export type AdminDeleteUploadsRes = DeleteResponse /** * @schema AdminUploadsDownloadUrlRes * type: object + * required: + * - download_url * properties: * download_url: - * type: string * description: The Download URL of the file + * type: string */ export type AdminUploadsDownloadUrlRes = { download_url: string diff --git a/packages/medusa/src/api/routes/admin/users/index.ts b/packages/medusa/src/api/routes/admin/users/index.ts index a23722bf69..afeef90d7e 100644 --- a/packages/medusa/src/api/routes/admin/users/index.ts +++ b/packages/medusa/src/api/routes/admin/users/index.ts @@ -38,6 +38,8 @@ export default (app) => { /** * @schema AdminUserRes * type: object + * required: + * - user * properties: * user: * $ref: "#/components/schemas/User" @@ -49,6 +51,8 @@ export type AdminUserRes = { /** * @schema AdminUsersListRes * type: object + * required: + * - users * properties: * users: * type: array @@ -62,6 +66,10 @@ export type AdminUsersListRes = { /** * @schema AdminDeleteUserRes * type: object + * required: + * - id + * - object + * - deleted * properties: * id: * type: string diff --git a/packages/medusa/src/api/routes/admin/variants/index.ts b/packages/medusa/src/api/routes/admin/variants/index.ts index 84efbc287a..c8edefca98 100644 --- a/packages/medusa/src/api/routes/admin/variants/index.ts +++ b/packages/medusa/src/api/routes/admin/variants/index.ts @@ -64,6 +64,11 @@ export const defaultAdminVariantFields: (keyof ProductVariant)[] = [ /** * @schema AdminVariantsListRes * type: object + * required: + * - variants + * - count + * - offset + * - limit * properties: * variants: * type: array