feat(oas): identify required fields in responses - admin (#3278)

## Scope

Admin routes

## What

Add OAS `required` to response schemas.

## Why

Code generator can use the `required` property of a schema to mark fields as optional or not when generating TS types.

## Test

* Run `yarn build`
* Run `yarn openapi:generate`
* Run `yarn redocly preview-docs docs/api/admin/openapi.yaml --config=docs-util/redocly/config.yaml`
* Open the documentation preview URL in a browser (http://127.0.0.1:8080)
* Expect responses to have their fields declared as `required`
This commit is contained in:
Patrick authored and GitHub committed 2023-02-17 14:19:13 +00:00
1 parent 3e274edb9e
commit 48ad2426aa
39 files changed
+435 -24

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
feat(oas): identify required fields in responses - admin
@@ -19,6 +19,8 @@ export default (app) => {
/** /**
* @schema AdminAppsRes * @schema AdminAppsRes
* type: object * type: object
* required:
* - apps
* properties: * properties:
* apps: * apps:
* $ref: "#/components/schemas/OAuth" * $ref: "#/components/schemas/OAuth"
@@ -30,6 +32,8 @@ export type AdminAppsRes = {
/** /**
* @schema AdminAppsListRes * @schema AdminAppsListRes
* type: object * type: object
* required:
* - apps
* properties: * properties:
* apps: * apps:
* type: array * type: array
@@ -26,6 +26,8 @@ export default (app) => {
/** /**
* @schema AdminAuthRes * @schema AdminAuthRes
* type: object * type: object
* required:
* - user
* properties: * properties:
* user: * user:
* $ref: "#/components/schemas/User" * $ref: "#/components/schemas/User"
@@ -1,6 +1,6 @@
import { Router } from "express" import { Router } from "express"
import { BatchJob } from "../../../.." import { BatchJob } from "../../../.."
import { DeleteResponse, PaginatedResponse } from "../../../../types/common" import { PaginatedResponse } from "../../../../types/common"
import middlewares, { import middlewares, {
canAccessBatchJob, canAccessBatchJob,
getRequestedBatchJob, getRequestedBatchJob,
@@ -45,6 +45,8 @@ export default (app) => {
/** /**
* @schema AdminBatchJobRes * @schema AdminBatchJobRes
* type: object * type: object
* required:
* - batch_job
* properties: * properties:
* batch_job: * batch_job:
* $ref: "#/components/schemas/BatchJob" * $ref: "#/components/schemas/BatchJob"
@@ -56,6 +58,11 @@ export type AdminBatchJobRes = {
/** /**
* @schema AdminBatchJobListRes * @schema AdminBatchJobListRes
* type: object * type: object
* required:
* - batch_jobs
* - count
* - offset
* - limit
* properties: * properties:
* batch_jobs: * batch_jobs:
* type: array * type: array
@@ -72,6 +72,11 @@ export const defaultAdminCollectionsRelations = ["products"]
/** /**
* @schema AdminCollectionsListRes * @schema AdminCollectionsListRes
* type: object * type: object
* required:
* - collections
* - count
* - offset
* - limit
* properties: * properties:
* collections: * collections:
* type: array * type: array
@@ -94,6 +99,10 @@ export type AdminCollectionsListRes = PaginatedResponse & {
/** /**
* @schema AdminCollectionsDeleteRes * @schema AdminCollectionsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -112,6 +121,10 @@ export type AdminCollectionsDeleteRes = DeleteResponse
/** /**
* @schema AdminDeleteProductsFromCollectionRes * @schema AdminDeleteProductsFromCollectionRes
* type: object * type: object
* required:
* - id
* - object
* - removed_products
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -136,6 +149,8 @@ export type AdminDeleteProductsFromCollectionRes = {
/** /**
* @schema AdminCollectionsRes * @schema AdminCollectionsRes
* type: object * type: object
* required:
* - collection
* properties: * properties:
* collection: * collection:
* $ref: "#/components/schemas/ProductCollection" * $ref: "#/components/schemas/ProductCollection"
@@ -35,6 +35,11 @@ export default (app) => {
/** /**
* @schema AdminCurrenciesListRes * @schema AdminCurrenciesListRes
* type: object * type: object
* required:
* - currencies
* - count
* - offset
* - limit
* properties: * properties:
* currencies: * currencies:
* type: array * type: array
@@ -57,6 +62,8 @@ export type AdminCurrenciesListRes = PaginatedResponse & {
/** /**
* @schema AdminCurrenciesRes * @schema AdminCurrenciesRes
* type: object * type: object
* required:
* - currency
* properties: * properties:
* currency: * currency:
* $ref: "#/components/schemas/Currency" * $ref: "#/components/schemas/Currency"
@@ -59,6 +59,8 @@ export default (app) => {
/** /**
* @schema AdminCustomerGroupsRes * @schema AdminCustomerGroupsRes
* type: object * type: object
* required:
* - customer_group
* properties: * properties:
* customer_group: * customer_group:
* $ref: "#/components/schemas/CustomerGroup" * $ref: "#/components/schemas/CustomerGroup"
@@ -70,6 +72,10 @@ export type AdminCustomerGroupsRes = {
/** /**
* @schema AdminCustomerGroupsDeleteRes * @schema AdminCustomerGroupsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -88,6 +94,11 @@ export type AdminCustomerGroupsDeleteRes = DeleteResponse
/** /**
* @schema AdminCustomerGroupsListRes * @schema AdminCustomerGroupsListRes
* type: object * type: object
* required:
* - customer_groups
* - count
* - offset
* - limit
* properties: * properties:
* customer_groups: * customer_groups:
* type: array * type: array
@@ -23,6 +23,8 @@ export default (app) => {
/** /**
* @schema AdminCustomersRes * @schema AdminCustomersRes
* type: object * type: object
* required:
* - customer
* properties: * properties:
* customer: * customer:
* $ref: "#/components/schemas/Customer" * $ref: "#/components/schemas/Customer"
@@ -34,6 +36,11 @@ export type AdminCustomersRes = {
/** /**
* @schema AdminCustomersListRes * @schema AdminCustomersListRes
* type: object * type: object
* required:
* - customers
* - count
* - offset
* - limit
* properties: * properties:
* customers: * customers:
* type: array * type: array
@@ -223,6 +223,8 @@ export const defaultAdminDiscountConditionRelations = ["discount_rule"]
/** /**
* @schema AdminDiscountsRes * @schema AdminDiscountsRes
* type: object * type: object
* required:
* - discount
* properties: * properties:
* discount: * discount:
* $ref: "#/components/schemas/Discount" * $ref: "#/components/schemas/Discount"
@@ -234,6 +236,8 @@ export type AdminDiscountsRes = {
/** /**
* @schema AdminDiscountConditionsRes * @schema AdminDiscountConditionsRes
* type: object * type: object
* required:
* - discount_condition
* properties: * properties:
* discount_condition: * discount_condition:
* $ref: "#/components/schemas/DiscountCondition" * $ref: "#/components/schemas/DiscountCondition"
@@ -245,6 +249,10 @@ export type AdminDiscountConditionsRes = {
/** /**
* @schema AdminDiscountsDeleteRes * @schema AdminDiscountsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -263,6 +271,11 @@ export type AdminDiscountsDeleteRes = DeleteResponse
/** /**
* @schema AdminDiscountConditionsDeleteRes * @schema AdminDiscountConditionsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* - discount
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -286,6 +299,11 @@ export type AdminDiscountConditionsDeleteRes = DeleteResponse & {
/** /**
* @schema AdminDiscountsListRes * @schema AdminDiscountsListRes
* type: object * type: object
* required:
* - discounts
* - count
* - offset
* - limit
* properties: * properties:
* discounts: * discounts:
* type: array * type: array
@@ -94,6 +94,8 @@ export const defaultAdminDraftOrdersFields: (keyof DraftOrder)[] = [
/** /**
* @schema AdminPostDraftOrdersDraftOrderRegisterPaymentRes * @schema AdminPostDraftOrdersDraftOrderRegisterPaymentRes
* type: object * type: object
* required:
* - order
* properties: * properties:
* order: * order:
* $ref: "#/components/schemas/Order" * $ref: "#/components/schemas/Order"
@@ -105,6 +107,8 @@ export type AdminPostDraftOrdersDraftOrderRegisterPaymentRes = {
/** /**
* @schema AdminDraftOrdersRes * @schema AdminDraftOrdersRes
* type: object * type: object
* required:
* - draft_order
* properties: * properties:
* draft_order: * draft_order:
* $ref: "#/components/schemas/DraftOrder" * $ref: "#/components/schemas/DraftOrder"
@@ -116,6 +120,10 @@ export type AdminDraftOrdersRes = {
/** /**
* @schema AdminDraftOrdersDeleteRes * @schema AdminDraftOrdersDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -134,6 +142,11 @@ export type AdminDraftOrdersDeleteRes = DeleteResponse
/** /**
* @schema AdminDraftOrdersListRes * @schema AdminDraftOrdersListRes
* type: object * type: object
* required:
* - draft_orders
* - count
* - offset
* - limit
* properties: * properties:
* draft_orders: * draft_orders:
* type: array * type: array
@@ -59,6 +59,8 @@ export const defaultAdminGiftCardRelations = ["region", "order"]
/** /**
* @schema AdminGiftCardsRes * @schema AdminGiftCardsRes
* type: object * type: object
* required:
* - gift_card
* properties: * properties:
* gift_card: * gift_card:
* $ref: "#/components/schemas/GiftCard" * $ref: "#/components/schemas/GiftCard"
@@ -70,6 +72,10 @@ export type AdminGiftCardsRes = {
/** /**
* @schema AdminGiftCardsDeleteRes * @schema AdminGiftCardsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -88,6 +94,11 @@ export type AdminGiftCardsDeleteRes = DeleteResponse
/** /**
* @schema AdminGiftCardsListRes * @schema AdminGiftCardsListRes
* type: object * type: object
* required:
* - gift_cards
* - count
* - offset
* - limit
* properties: * properties:
* gift_cards: * gift_cards:
* type: array * type: array
@@ -14,12 +14,12 @@ import { AdminGetInventoryItemsItemParams } from "./get-inventory-item"
import { AdminPostInventoryItemsInventoryItemReq } from "./update-inventory-item" import { AdminPostInventoryItemsInventoryItemReq } from "./update-inventory-item"
import { AdminGetInventoryItemsItemLocationLevelsParams } from "./list-location-levels" import { AdminGetInventoryItemsItemLocationLevelsParams } from "./list-location-levels"
import { import {
AdminPostInventoryItemsItemLocationLevelsReq,
AdminPostInventoryItemsItemLocationLevelsParams, AdminPostInventoryItemsItemLocationLevelsParams,
AdminPostInventoryItemsItemLocationLevelsReq,
} from "./create-location-level" } from "./create-location-level"
import { import {
AdminPostInventoryItemsItemLocationLevelsLevelReq,
AdminPostInventoryItemsItemLocationLevelsLevelParams, AdminPostInventoryItemsItemLocationLevelsLevelParams,
AdminPostInventoryItemsItemLocationLevelsLevelReq,
} from "./update-location-level" } from "./update-location-level"
import { checkRegisteredModules } from "../../../middlewares/check-registered-modules" import { checkRegisteredModules } from "../../../middlewares/check-registered-modules"
import { ProductVariant } from "../../../../models" import { ProductVariant } from "../../../../models"
@@ -134,6 +134,8 @@ export const defaultAdminInventoryItemRelations = []
/** /**
* @schema AdminInventoryItemsRes * @schema AdminInventoryItemsRes
* type: object * type: object
* required:
* - inventory_item
* properties: * properties:
* inventory_item: * inventory_item:
* $ref: "#/components/schemas/InventoryItemDTO" * $ref: "#/components/schemas/InventoryItemDTO"
@@ -145,6 +147,10 @@ export type AdminInventoryItemsRes = {
/** /**
* @schema AdminInventoryItemsDeleteRes * @schema AdminInventoryItemsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -163,6 +169,11 @@ export type AdminInventoryItemsDeleteRes = DeleteResponse
/** /**
* @schema AdminInventoryItemsListRes * @schema AdminInventoryItemsListRes
* type: object * type: object
* required:
* - inventory_items
* - count
* - offset
* - limit
* properties: * properties:
* inventory_items: * inventory_items:
* type: array * type: array
@@ -185,6 +196,11 @@ export type AdminInventoryItemsListRes = PaginatedResponse & {
/** /**
* @schema AdminInventoryItemsListWithVariantsAndLocationLevelsRes * @schema AdminInventoryItemsListWithVariantsAndLocationLevelsRes
* type: object * type: object
* required:
* - inventory_items
* - count
* - offset
* - limit
* properties: * properties:
* inventory_items: * inventory_items:
* type: array * type: array
@@ -222,14 +238,22 @@ export type AdminInventoryItemsListWithVariantsAndLocationLevelsRes =
/** /**
* @schema AdminInventoryItemsLocationLevelsRes * @schema AdminInventoryItemsLocationLevelsRes
* type: object * type: object
* required:
* - inventory_item
* properties: * properties:
* id: * inventory_item:
* description: The id of the location * type: object
* location_levels: * required:
* description: List of stock levels at a given location * - id
* type: array * - location_levels
* items: * properties:
* $ref: "#/components/schemas/InventoryLevelDTO" * 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 = { export type AdminInventoryItemsLocationLevelsRes = {
inventory_item: { inventory_item: {
@@ -35,6 +35,10 @@ export default (app) => {
/** /**
* @schema AdminInviteDeleteRes * @schema AdminInviteDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -53,6 +57,8 @@ export type AdminInviteDeleteRes = DeleteResponse
/** /**
* @schema AdminListInvitesRes * @schema AdminListInvitesRes
* type: object * type: object
* required:
* - invites
* properties: * properties:
* invites: * invites:
* type: array * type: array
@@ -25,6 +25,8 @@ export default (app) => {
/** /**
* @schema AdminNotesRes * @schema AdminNotesRes
* type: object * type: object
* required:
* - note
* properties: * properties:
* note: * note:
* $ref: "#/components/schemas/Note" * $ref: "#/components/schemas/Note"
@@ -36,6 +38,10 @@ export type AdminNotesRes = {
/** /**
* @schema AdminNotesDeleteRes * @schema AdminNotesDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -54,6 +60,11 @@ export type AdminNotesDeleteRes = DeleteResponse
/** /**
* @schema AdminNotesListRes * @schema AdminNotesListRes
* type: object * type: object
* required:
* - notes
* - count
* - offset
* - limit
* properties: * properties:
* notes: * notes:
* type: array * type: array
@@ -39,6 +39,8 @@ export const defaultAdminNotificationsFields = [
/** /**
* @schema AdminNotificationsListRes * @schema AdminNotificationsListRes
* type: object * type: object
* required:
* - notifications
* properties: * properties:
* notifications: * notifications:
* type: array * type: array
@@ -52,6 +54,8 @@ export type AdminNotificationsListRes = {
/** /**
* @schema AdminNotificationsRes * @schema AdminNotificationsRes
* type: object * type: object
* required:
* - notification
* properties: * properties:
* notification: * notification:
* $ref: "#/components/schemas/Notification" * $ref: "#/components/schemas/Notification"
@@ -101,6 +101,8 @@ export default (app) => {
/** /**
* @schema AdminOrderEditsRes * @schema AdminOrderEditsRes
* type: object * type: object
* required:
* - order_edit
* properties: * properties:
* order_edit: * order_edit:
* $ref: "#/components/schemas/OrderEdit" * $ref: "#/components/schemas/OrderEdit"
@@ -112,6 +114,11 @@ export type AdminOrderEditsRes = {
/** /**
* @schema AdminOrderEditsListRes * @schema AdminOrderEditsListRes
* type: object * type: object
* required:
* - order_edits
* - count
* - offset
* - limit
* properties: * properties:
* order_edits: * order_edits:
* type: array * type: array
@@ -134,6 +141,10 @@ export type AdminOrderEditsListRes = PaginatedResponse & {
/** /**
* @schema AdminOrderEditDeleteRes * @schema AdminOrderEditDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -152,6 +163,10 @@ export type AdminOrderEditDeleteRes = DeleteResponse
/** /**
* @schema AdminOrderEditItemChangeDeleteRes * @schema AdminOrderEditItemChangeDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -264,6 +264,8 @@ export default (app, featureFlagRouter: FlagRouter) => {
/** /**
* @schema AdminOrdersRes * @schema AdminOrdersRes
* type: object * type: object
* required:
* - order
* properties: * properties:
* order: * order:
* $ref: "#/components/schemas/Order" * $ref: "#/components/schemas/Order"
@@ -275,6 +277,11 @@ export type AdminOrdersRes = {
/** /**
* @schema AdminOrdersListRes * @schema AdminOrdersListRes
* type: object * type: object
* required:
* - orders
* - count
* - offset
* - limit
* properties: * properties:
* orders: * orders:
* type: array * type: array
@@ -65,6 +65,8 @@ export const defaulPaymentCollectionRelations = [
/** /**
* @schema AdminPaymentCollectionsRes * @schema AdminPaymentCollectionsRes
* type: object * type: object
* required:
* - payment_collection
* properties: * properties:
* payment_collection: * payment_collection:
* $ref: "#/components/schemas/PaymentCollection" * $ref: "#/components/schemas/PaymentCollection"
@@ -76,6 +78,10 @@ export type AdminPaymentCollectionsRes = {
/** /**
* @schema AdminPaymentCollectionDeleteRes * @schema AdminPaymentCollectionDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -55,6 +55,8 @@ export const defaultPaymentFields = [
/** /**
* @schema AdminPaymentRes * @schema AdminPaymentRes
* type: object * type: object
* required:
* - payment
* properties: * properties:
* payment: * payment:
* $ref: "#/components/schemas/Payment" * $ref: "#/components/schemas/Payment"
@@ -66,6 +68,8 @@ export type AdminPaymentRes = {
/** /**
* @schema AdminRefundRes * @schema AdminRefundRes
* type: object * type: object
* required:
* - refund
* properties: * properties:
* refund: * refund:
* $ref: "#/components/schemas/Refund" * $ref: "#/components/schemas/Refund"
@@ -96,6 +96,8 @@ export const defaultAdminPriceListRelations = ["prices", "customer_groups"]
/** /**
* @schema AdminPriceListRes * @schema AdminPriceListRes
* type: object * type: object
* required:
* - price_list
* properties: * properties:
* price_list: * price_list:
* $ref: "#/components/schemas/PriceList" * $ref: "#/components/schemas/PriceList"
@@ -107,6 +109,10 @@ export type AdminPriceListRes = {
/** /**
* @schema AdminPriceListDeleteBatchRes * @schema AdminPriceListDeleteBatchRes
* type: object * type: object
* required:
* - ids
* - object
* - deleted
* properties: * properties:
* ids: * ids:
* type: array * type: array
@@ -131,6 +137,10 @@ export type AdminPriceListDeleteBatchRes = {
/** /**
* @schema AdminPriceListDeleteProductPricesRes * @schema AdminPriceListDeleteProductPricesRes
* type: object * type: object
* required:
* - ids
* - object
* - deleted
* properties: * properties:
* ids: * ids:
* type: array * type: array
@@ -151,6 +161,10 @@ export type AdminPriceListDeleteProductPricesRes = AdminPriceListDeleteBatchRes
/** /**
* @schema AdminPriceListDeleteVariantPricesRes * @schema AdminPriceListDeleteVariantPricesRes
* type: object * type: object
* required:
* - ids
* - object
* - deleted
* properties: * properties:
* ids: * ids:
* type: array * type: array
@@ -171,6 +185,10 @@ export type AdminPriceListDeleteVariantPricesRes = AdminPriceListDeleteBatchRes
/** /**
* @schema AdminPriceListDeleteRes * @schema AdminPriceListDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -189,6 +207,11 @@ export type AdminPriceListDeleteRes = DeleteResponse
/** /**
* @schema AdminPriceListsListRes * @schema AdminPriceListsListRes
* type: object * type: object
* required:
* - price_lists
* - count
* - offset
* - limit
* properties: * properties:
* price_lists: * price_lists:
* type: array * type: array
@@ -211,6 +234,11 @@ export type AdminPriceListsListRes = PaginatedResponse & {
/** /**
* @schema AdminPriceListsProductsListRes * @schema AdminPriceListsProductsListRes
* type: object * type: object
* required:
* - products
* - count
* - offset
* - limit
* properties: * properties:
* products: * products:
* type: array * type: array
@@ -1,8 +1,8 @@
import { Router } from "express" import { Router } from "express"
import middlewares, { import middlewares, {
transformQuery,
transformBody, transformBody,
transformQuery,
} from "../../../middlewares" } from "../../../middlewares"
import { DeleteResponse, PaginatedResponse } from "../../../../types/common" import { DeleteResponse, PaginatedResponse } from "../../../../types/common"
@@ -19,23 +19,23 @@ import listProductCategories, {
} from "./list-product-categories" } from "./list-product-categories"
import createProductCategory, { import createProductCategory, {
AdminPostProductCategoriesReq,
AdminPostProductCategoriesParams, AdminPostProductCategoriesParams,
AdminPostProductCategoriesReq,
} from "./create-product-category" } from "./create-product-category"
import updateProductCategory, { import updateProductCategory, {
AdminPostProductCategoriesCategoryReq,
AdminPostProductCategoriesCategoryParams, AdminPostProductCategoriesCategoryParams,
AdminPostProductCategoriesCategoryReq,
} from "./update-product-category" } from "./update-product-category"
import addProductsBatch, { import addProductsBatch, {
AdminPostProductCategoriesCategoryProductsBatchReq,
AdminPostProductCategoriesCategoryProductsBatchParams, AdminPostProductCategoriesCategoryProductsBatchParams,
AdminPostProductCategoriesCategoryProductsBatchReq,
} from "./add-products-batch" } from "./add-products-batch"
import deleteProductsBatch, { import deleteProductsBatch, {
AdminDeleteProductCategoriesCategoryProductsBatchReq,
AdminDeleteProductCategoriesCategoryProductsBatchParams, AdminDeleteProductCategoriesCategoryProductsBatchParams,
AdminDeleteProductCategoriesCategoryProductsBatchReq,
} from "./delete-products-batch" } from "./delete-products-batch"
import { ProductCategory } from "../../../../models" import { ProductCategory } from "../../../../models"
@@ -152,6 +152,8 @@ export const defaultProductCategoryFields = [
/** /**
* @schema AdminProductCategoriesCategoryRes * @schema AdminProductCategoriesCategoryRes
* type: object * type: object
* required:
* - product_category
* properties: * properties:
* product_category: * product_category:
* $ref: "#/components/schemas/ProductCategory" * $ref: "#/components/schemas/ProductCategory"
@@ -163,6 +165,10 @@ export type AdminProductCategoriesCategoryRes = {
/** /**
* @schema AdminProductCategoriesCategoryDeleteRes * @schema AdminProductCategoriesCategoryDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -181,6 +187,11 @@ export type AdminProductCategoriesCategoryDeleteRes = DeleteResponse
/** /**
* @schema AdminProductCategoriesListRes * @schema AdminProductCategoriesListRes
* type: object * type: object
* required:
* - product_categories
* - count
* - offset
* - limit
* properties: * properties:
* product_categories: * product_categories:
* type: array * type: array
@@ -34,6 +34,11 @@ export const defaultAdminProductTagsRelations = []
/** /**
* @schema AdminProductTagsListRes * @schema AdminProductTagsListRes
* type: object * type: object
* required:
* - product_tags
* - count
* - offset
* - limit
* properties: * properties:
* product_tags: * product_tags:
* type: array * type: array
@@ -34,6 +34,11 @@ export const defaultAdminProductTypeRelations = []
/** /**
* @schema AdminProductTypesListRes * @schema AdminProductTypesListRes
* type: object * type: object
* required:
* - product_types
* - count
* - offset
* - limit
* properties: * properties:
* product_types: * product_types:
* type: array * type: array
@@ -136,6 +136,11 @@ export const defaultAdminGetProductsVariantsFields = ["id", "product_id"]
/** /**
* @schema AdminProductsDeleteOptionRes * @schema AdminProductsDeleteOptionRes
* type: object * type: object
* required:
* - option_id
* - object
* - deleted
* - product
* properties: * properties:
* option_id: * option_id:
* type: string * type: string
@@ -161,6 +166,11 @@ export type AdminProductsDeleteOptionRes = {
/** /**
* @schema AdminProductsDeleteVariantRes * @schema AdminProductsDeleteVariantRes
* type: object * type: object
* required:
* - variant_id
* - object
* - deleted
* - product
* properties: * properties:
* variant_id: * variant_id:
* type: string * type: string
@@ -186,6 +196,10 @@ export type AdminProductsDeleteVariantRes = {
/** /**
* @schema AdminProductsDeleteRes * @schema AdminProductsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -208,6 +222,11 @@ export type AdminProductsDeleteRes = {
/** /**
* @schema AdminProductsListRes * @schema AdminProductsListRes
* type: object * type: object
* required:
* - products
* - count
* - offset
* - limit
* properties: * properties:
* products: * products:
* type: array * type: array
@@ -232,6 +251,11 @@ export type AdminProductsListRes = PaginatedResponse & {
/** /**
* @schema AdminProductsListVariantsRes * @schema AdminProductsListVariantsRes
* type: object * type: object
* required:
* - variants
* - count
* - offset
* - limit
* properties: * properties:
* variants: * variants:
* type: array * type: array
@@ -254,6 +278,8 @@ export type AdminProductsListVariantsRes = PaginatedResponse & {
/** /**
* @schema AdminProductsListTypesRes * @schema AdminProductsListTypesRes
* type: object * type: object
* required:
* - types
* properties: * properties:
* types: * types:
* type: array * type: array
@@ -267,11 +293,17 @@ export type AdminProductsListTypesRes = {
/** /**
* @schema AdminProductsListTagsRes * @schema AdminProductsListTagsRes
* type: object * type: object
* required:
* - tags
* properties: * properties:
* tags: * tags:
* type: array * type: array
* items: * items:
* type: object * type: object
* required:
* - id
* - usage_count
* - value
* properties: * properties:
* id: * id:
* description: The ID of the tag. * description: The ID of the tag.
@@ -294,6 +326,8 @@ export type AdminProductsListTagsRes = {
/** /**
* @schema AdminProductsRes * @schema AdminProductsRes
* type: object * type: object
* required:
* - product
* properties: * properties:
* product: * product:
* $ref: "#/components/schemas/Product" * $ref: "#/components/schemas/Product"
@@ -83,6 +83,8 @@ export default (app) => {
/** /**
* @schema AdminPublishableApiKeysRes * @schema AdminPublishableApiKeysRes
* type: object * type: object
* required:
* - publishable_api_key
* properties: * properties:
* publishable_api_key: * publishable_api_key:
* $ref: "#/components/schemas/PublishableApiKey" * $ref: "#/components/schemas/PublishableApiKey"
@@ -94,6 +96,11 @@ export type AdminPublishableApiKeysRes = {
/** /**
* @schema AdminPublishableApiKeysListRes * @schema AdminPublishableApiKeysListRes
* type: object * type: object
* required:
* - publishable_api_keys
* - count
* - offset
* - limit
* properties: * properties:
* publishable_api_keys: * publishable_api_keys:
* type: array * type: array
@@ -116,6 +123,10 @@ export type AdminPublishableApiKeysListRes = PaginatedResponse & {
/** /**
* @schema AdminPublishableApiKeyDeleteRes * @schema AdminPublishableApiKeyDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -134,6 +145,8 @@ export type AdminPublishableApiKeyDeleteRes = DeleteResponse
/** /**
* @schema AdminPublishableApiKeysListSalesChannelsRes * @schema AdminPublishableApiKeysListSalesChannelsRes
* type: object * type: object
* required:
* - sales_channels
* properties: * properties:
* sales_channels: * sales_channels:
* type: array * type: array
@@ -88,6 +88,8 @@ export const defaultAdminRegionRelations = [
/** /**
* @schema AdminRegionsRes * @schema AdminRegionsRes
* type: object * type: object
* required:
* - region
* properties: * properties:
* region: * region:
* $ref: "#/components/schemas/Region" * $ref: "#/components/schemas/Region"
@@ -99,6 +101,11 @@ export class AdminRegionsRes {
/** /**
* @schema AdminRegionsListRes * @schema AdminRegionsListRes
* type: object * type: object
* required:
* - regions
* - count
* - offset
* - limit
* properties: * properties:
* regions: * regions:
* type: array * type: array
@@ -121,6 +128,10 @@ export type AdminRegionsListRes = PaginatedResponse & {
/** /**
* @schema AdminRegionsDeleteRes * @schema AdminRegionsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -144,22 +155,29 @@ export class FulfillmentOption {
/** /**
* @schema AdminGetRegionsRegionFulfillmentOptionsRes * @schema AdminGetRegionsRegionFulfillmentOptionsRes
* type: object * type: object
* required:
* - fulfillment_options
* properties: * properties:
* fulfillment_options: * fulfillment_options:
* type: array * type: array
* items: * items:
* type: object * type: object
* required:
* - provider_id
* - options
* properties: * properties:
* provider_id: * provider_id:
* type: string
* description: ID of the fulfillment provider * description: ID of the fulfillment provider
* type: string
* options: * options:
* type: array
* description: fulfillment provider options * description: fulfillment provider options
* example: * type: array
* - id: "manual-fulfillment" * items:
* - id: "manual-fulfillment-return" * type: object
* is_return: true * example:
* - id: "manual-fulfillment"
* - id: "manual-fulfillment-return"
* is_return: true
*/ */
export class AdminGetRegionsRegionFulfillmentOptionsRes { export class AdminGetRegionsRegionFulfillmentOptionsRes {
fulfillment_options: FulfillmentOption[] fulfillment_options: FulfillmentOption[]
@@ -1,5 +1,5 @@
import { Router } from "express" import { Router } from "express"
import { Note, ReservationItemDTO } from "../../../.." import { ReservationItemDTO } from "../../../.."
import { DeleteResponse, PaginatedResponse } from "../../../../types/common" import { DeleteResponse, PaginatedResponse } from "../../../../types/common"
import middlewares, { import middlewares, {
transformBody, transformBody,
@@ -71,6 +71,11 @@ export type AdminReservationsRes = {
/** /**
* @schema AdminGetReservationReservationsReq * @schema AdminGetReservationReservationsReq
* type: object * type: object
* required:
* - reservations
* - count
* - offset
* - limit
* properties: * properties:
* reservations: * reservations:
* type: array * type: array
@@ -55,6 +55,8 @@ export const defaultAdminReturnReasonsRelations: (keyof ReturnReason)[] = [
/** /**
* @schema AdminReturnReasonsRes * @schema AdminReturnReasonsRes
* type: object * type: object
* required:
* - return_reason
* properties: * properties:
* return_reason: * return_reason:
* $ref: "#/components/schemas/ReturnReason" * $ref: "#/components/schemas/ReturnReason"
@@ -66,6 +68,8 @@ export type AdminReturnReasonsRes = {
/** /**
* @schema AdminReturnReasonsListRes * @schema AdminReturnReasonsListRes
* type: object * type: object
* required:
* - return_reasons
* properties: * properties:
* return_reasons: * return_reasons:
* type: array * type: array
@@ -79,6 +83,10 @@ export type AdminReturnReasonsListRes = {
/** /**
* @schema AdminReturnReasonsDeleteRes * @schema AdminReturnReasonsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -30,6 +30,8 @@ export default (app) => {
/** /**
* @schema AdminReturnsCancelRes * @schema AdminReturnsCancelRes
* type: object * type: object
* required:
* - order
* properties: * properties:
* order: * order:
* $ref: "#/components/schemas/Order" * $ref: "#/components/schemas/Order"
@@ -41,6 +43,11 @@ export type AdminReturnsCancelRes = {
/** /**
* @schema AdminReturnsListRes * @schema AdminReturnsListRes
* type: object * type: object
* required:
* - returns
* - count
* - offset
* - limit
* properties: * properties:
* returns: * returns:
* type: array * type: array
@@ -63,6 +70,8 @@ export type AdminReturnsListRes = PaginatedResponse & {
/** /**
* @schema AdminReturnsRes * @schema AdminReturnsRes
* type: object * type: object
* required:
* - return
* properties: * properties:
* return: * return:
* $ref: "#/components/schemas/Return" * $ref: "#/components/schemas/Return"
@@ -88,6 +88,8 @@ export default (app) => {
/** /**
* @schema AdminSalesChannelsRes * @schema AdminSalesChannelsRes
* type: object * type: object
* required:
* - sales_channel
* properties: * properties:
* sales_channel: * sales_channel:
* $ref: "#/components/schemas/SalesChannel" * $ref: "#/components/schemas/SalesChannel"
@@ -99,6 +101,10 @@ export type AdminSalesChannelsRes = {
/** /**
* @schema AdminSalesChannelsDeleteRes * @schema AdminSalesChannelsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -117,6 +123,10 @@ export type AdminSalesChannelsDeleteRes = DeleteResponse
/** /**
* @schema AdminSalesChannelsDeleteLocationRes * @schema AdminSalesChannelsDeleteLocationRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -135,6 +145,11 @@ export type AdminSalesChannelsDeleteLocationRes = DeleteResponse
/** /**
* @schema AdminSalesChannelsListRes * @schema AdminSalesChannelsListRes
* type: object * type: object
* required:
* - sales_channels
* - count
* - offset
* - limit
* properties: * properties:
* sales_channels: * sales_channels:
* type: array * type: array
@@ -55,6 +55,11 @@ export const defaultRelations = ["region", "profile", "requirements"]
/** /**
* @schema AdminShippingOptionsListRes * @schema AdminShippingOptionsListRes
* type: object * type: object
* required:
* - shipping_options
* - count
* - offset
* - limit
* properties: * properties:
* shipping_options: * shipping_options:
* type: array * type: array
@@ -63,6 +68,12 @@ export const defaultRelations = ["region", "profile", "requirements"]
* count: * count:
* type: integer * type: integer
* description: The total number of items available * 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 & { export type AdminShippingOptionsListRes = PaginatedResponse & {
shipping_options: ShippingOption[] shipping_options: ShippingOption[]
@@ -71,6 +82,8 @@ export type AdminShippingOptionsListRes = PaginatedResponse & {
/** /**
* @schema AdminShippingOptionsRes * @schema AdminShippingOptionsRes
* type: object * type: object
* required:
* - shipping_option
* properties: * properties:
* shipping_option: * shipping_option:
* $ref: "#/components/schemas/ShippingOption" * $ref: "#/components/schemas/ShippingOption"
@@ -82,6 +95,10 @@ export type AdminShippingOptionsRes = {
/** /**
* @schema AdminShippingOptionsDeleteRes * @schema AdminShippingOptionsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -47,6 +47,10 @@ export const defaultAdminShippingProfilesRelations: (keyof ShippingProfile)[] =
/** /**
* @schema AdminDeleteShippingProfileRes * @schema AdminDeleteShippingProfileRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -65,6 +69,8 @@ export type AdminDeleteShippingProfileRes = DeleteResponse
/** /**
* @schema AdminShippingProfilesRes * @schema AdminShippingProfilesRes
* type: object * type: object
* required:
* - shipping_profile
* properties: * properties:
* shipping_profile: * shipping_profile:
* $ref: "#/components/schemas/ShippingProfile" * $ref: "#/components/schemas/ShippingProfile"
@@ -76,6 +82,8 @@ export type AdminShippingProfilesRes = {
/** /**
* @schema AdminShippingProfilesListRes * @schema AdminShippingProfilesListRes
* type: object * type: object
* required:
* - shipping_profiles
* properties: * properties:
* shipping_profiles: * shipping_profiles:
* type: array * type: array
@@ -96,6 +96,10 @@ export const defaultAdminStockLocationRelations = []
/** /**
* @schema AdminStockLocationsDeleteRes * @schema AdminStockLocationsDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -114,6 +118,8 @@ export type AdminStockLocationsDeleteRes = DeleteResponse
/** /**
* @schema AdminStockLocationsRes * @schema AdminStockLocationsRes
* type: object * type: object
* required:
* - stock_location
* properties: * properties:
* stock_location: * stock_location:
* $ref: "#/components/schemas/StockLocationExpandedDTO" * $ref: "#/components/schemas/StockLocationExpandedDTO"
@@ -125,6 +131,11 @@ export type AdminStockLocationsRes = {
/** /**
* @schema AdminStockLocationsListRes * @schema AdminStockLocationsListRes
* type: object * type: object
* required:
* - stock_locations
* - count
* - offset
* - limit
* properties: * properties:
* stock_locations: * stock_locations:
* type: array * type: array
@@ -33,6 +33,8 @@ export default (app) => {
/** /**
* @schema AdminStoresRes * @schema AdminStoresRes
* type: object * type: object
* required:
* - store
* properties: * properties:
* store: * store:
* $ref: "#/components/schemas/ExtendedStoreDTO" * $ref: "#/components/schemas/ExtendedStoreDTO"
@@ -44,6 +46,8 @@ export type AdminStoresRes = {
/** /**
* @schema AdminTaxProvidersList * @schema AdminTaxProvidersList
* type: object * type: object
* required:
* - tax_providers
* properties: * properties:
* tax_providers: * tax_providers:
* type: array * type: array
@@ -57,6 +61,8 @@ export type AdminTaxProvidersList = {
/** /**
* @schema AdminPaymentProvidersList * @schema AdminPaymentProvidersList
* type: object * type: object
* required:
* - payment_providers
* properties: * properties:
* payment_providers: * payment_providers:
* type: array * type: array
@@ -57,6 +57,11 @@ export const defaultAdminSwapFields = [
/** /**
* @schema AdminSwapsListRes * @schema AdminSwapsListRes
* type: object * type: object
* required:
* - swaps
* - count
* - offset
* - limit
* properties: * properties:
* swaps: * swaps:
* type: array * type: array
@@ -79,6 +84,8 @@ export type AdminSwapsListRes = PaginatedResponse & {
/** /**
* @schema AdminSwapsRes * @schema AdminSwapsRes
* type: object * type: object
* required:
* - swap
* properties: * properties:
* swap: * swap:
* $ref: "#/components/schemas/Swap" * $ref: "#/components/schemas/Swap"
@@ -99,6 +99,10 @@ export const defaultAdminTaxRatesFields: (keyof TaxRate)[] = [
/** /**
* @schema AdminTaxRatesDeleteRes * @schema AdminTaxRatesDeleteRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -117,6 +121,11 @@ export type AdminTaxRatesDeleteRes = DeleteResponse
/** /**
* @schema AdminTaxRatesListRes * @schema AdminTaxRatesListRes
* type: object * type: object
* required:
* - tax_rates
* - count
* - offset
* - limit
* properties: * properties:
* tax_rates: * tax_rates:
* type: array * type: array
@@ -139,6 +148,8 @@ export type AdminTaxRatesListRes = PaginatedResponse & {
/** /**
* @schema AdminTaxRatesRes * @schema AdminTaxRatesRes
* type: object * type: object
* required:
* - tax_rate
* properties: * properties:
* tax_rate: * tax_rate:
* $ref: "#/components/schemas/TaxRate" * $ref: "#/components/schemas/TaxRate"
@@ -42,15 +42,19 @@ export default (app) => {
/** /**
* @schema AdminUploadsRes * @schema AdminUploadsRes
* type: object * type: object
* required:
* - uploads
* properties: * properties:
* uploads: * uploads:
* type: array * type: array
* items: * items:
* type: object * type: object
* required:
* - url
* properties: * properties:
* url: * url:
* type: string
* description: The URL of the uploaded file. * description: The URL of the uploaded file.
* type: string
* format: uri * format: uri
*/ */
export type AdminUploadsRes = { export type AdminUploadsRes = {
@@ -60,6 +64,10 @@ export type AdminUploadsRes = {
/** /**
* @schema AdminDeleteUploadsRes * @schema AdminDeleteUploadsRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -78,10 +86,12 @@ export type AdminDeleteUploadsRes = DeleteResponse
/** /**
* @schema AdminUploadsDownloadUrlRes * @schema AdminUploadsDownloadUrlRes
* type: object * type: object
* required:
* - download_url
* properties: * properties:
* download_url: * download_url:
* type: string
* description: The Download URL of the file * description: The Download URL of the file
* type: string
*/ */
export type AdminUploadsDownloadUrlRes = { export type AdminUploadsDownloadUrlRes = {
download_url: string download_url: string
@@ -38,6 +38,8 @@ export default (app) => {
/** /**
* @schema AdminUserRes * @schema AdminUserRes
* type: object * type: object
* required:
* - user
* properties: * properties:
* user: * user:
* $ref: "#/components/schemas/User" * $ref: "#/components/schemas/User"
@@ -49,6 +51,8 @@ export type AdminUserRes = {
/** /**
* @schema AdminUsersListRes * @schema AdminUsersListRes
* type: object * type: object
* required:
* - users
* properties: * properties:
* users: * users:
* type: array * type: array
@@ -62,6 +66,10 @@ export type AdminUsersListRes = {
/** /**
* @schema AdminDeleteUserRes * @schema AdminDeleteUserRes
* type: object * type: object
* required:
* - id
* - object
* - deleted
* properties: * properties:
* id: * id:
* type: string * type: string
@@ -64,6 +64,11 @@ export const defaultAdminVariantFields: (keyof ProductVariant)[] = [
/** /**
* @schema AdminVariantsListRes * @schema AdminVariantsListRes
* type: object * type: object
* required:
* - variants
* - count
* - offset
* - limit
* properties: * properties:
* variants: * variants:
* type: array * type: array