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
2023-02-17 09:19:13 -05:00
committed by GitHub
parent 3e274edb9e
commit 48ad2426aa
39 changed files with 435 additions and 24 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
feat(oas): identify required fields in responses - admin

View File

@@ -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

View File

@@ -26,6 +26,8 @@ export default (app) => {
/**
* @schema AdminAuthRes
* type: object
* required:
* - user
* properties:
* user:
* $ref: "#/components/schemas/User"

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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: {

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -34,6 +34,11 @@ export const defaultAdminProductTagsRelations = []
/**
* @schema AdminProductTagsListRes
* type: object
* required:
* - product_tags
* - count
* - offset
* - limit
* properties:
* product_tags:
* type: array

View File

@@ -34,6 +34,11 @@ export const defaultAdminProductTypeRelations = []
/**
* @schema AdminProductTypesListRes
* type: object
* required:
* - product_types
* - count
* - offset
* - limit
* properties:
* product_types:
* type: array

View File

@@ -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"

View File

@@ -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

View File

@@ -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[]

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -64,6 +64,11 @@ export const defaultAdminVariantFields: (keyof ProductVariant)[] = [
/**
* @schema AdminVariantsListRes
* type: object
* required:
* - variants
* - count
* - offset
* - limit
* properties:
* variants:
* type: array