feat(oas): declare x-codegen on Admin routes - S to V (#3102)
### What Declare `x-codegen` in OAS for Admin routes - S to V. ### Why We are introducing a new `x-codegen` OpenApi extension, also known as _vendor extension_, in order to help with passing information down to code generators. In our case, we wish to declare the `method` name that we would expect to call on a client. This mimics our current JS client package. E.g. `medusaClient.product.list` where `product` is the tag of the route and `list` is the x-codegen.method value. We are also defining the name of a potential typed object for query parameters. OAS 3.0 does not allow to bundle query parameters under a single definition but it is not uncommon to see API clients handle all query parameters as a single typed object, like our JS client package. With x-codegen.queryParams, a code generator can create a named and typed object to bundle all query parameters for a given route. E.g. `medusaClient.customer.retrieve(id: string, queryParams: AdminGetCustomerParams)` ### How Declare `x-codegen` as an object with fields `method` and `queryParams` on all paths. Match method and queryParams values with equivalent ones from our current JS client package. ### Test * Ran OAS validator. * Ran docs build script. Expect no visible changes to the documentation.
This commit is contained in:
5
.changeset/clean-dancers-relax.md
Normal file
5
.changeset/clean-dancers-relax.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
feat(oas): declare x-codegen on Admin routes - S to V
|
||||
@@ -19,6 +19,8 @@ import { Type } from "class-transformer"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostSalesChannelsChannelProductsBatchReq"
|
||||
* x-codegen:
|
||||
* method: addProducts
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -20,6 +20,8 @@ import {
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostSalesChannelsChannelStockLocationsReq"
|
||||
* x-codegen:
|
||||
* method: addLocation
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -16,6 +16,8 @@ import SalesChannelService from "../../../../services/sales-channel"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostSalesChannelsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -19,6 +19,8 @@ import { Type } from "class-transformer"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteSalesChannelsChannelProductsBatchReq"
|
||||
* x-codegen:
|
||||
* method: removeProducts
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,6 +11,8 @@ import { SalesChannelService } from "../../../../services/"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Sales channel.
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -10,6 +10,8 @@ import { SalesChannelService } from "../../../../services"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Sales channel.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -90,6 +90,9 @@ import { Type } from "class-transformer"
|
||||
* - (query) limit=20 {integer} Limit the number of sales channels returned.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each sales channel of the result.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be included in each sales channel of the result.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetSalesChannelsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import { SalesChannelLocationService } from "../../../../services"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteSalesChannelsChannelStockLocationsReq"
|
||||
* x-codegen:
|
||||
* method: removeLocation
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostSalesChannelsSalesChannelReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -26,6 +26,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostShippingOptionsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -8,6 +8,8 @@ import { EntityManager } from "typeorm"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Shipping Option.
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Shipping Option.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -28,6 +28,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* schema:
|
||||
* type: boolean
|
||||
* description: Flag for fetching admin specific options
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetShippingOptionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -28,6 +28,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostShippingOptionsOptionReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -14,6 +14,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostShippingProfilesReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { ShippingProfileService } from "../../../../services"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Shipping Profile.
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -13,6 +13,8 @@ import { ShippingProfileService } from "../../../../services"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Shipping Profile.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -6,6 +6,8 @@ import { ShippingProfileService } from "../../../../services"
|
||||
* summary: "List Shipping Profiles"
|
||||
* description: "Retrieves a list of Shipping Profile."
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -16,6 +16,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostShippingProfilesProfileReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -19,6 +19,8 @@ import { FindParams } from "../../../../types/common"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostStockLocationsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,6 +12,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* - (path) id=* {string} The ID of the Stock Location.
|
||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||
* - (query) fields {string} Comma separated list of fields to include in the results.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* queryParams: AdminGetStockLocationsLocationParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -85,6 +85,9 @@ import { Request, Response } from "express"
|
||||
* - (query) limit=20 {integer} Limit the number of stock locations returned.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each stock location of the result.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be included in each stock location of the result.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetStockLocationsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -20,6 +20,8 @@ import { FindParams } from "../../../../types/common"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostStockLocationsLocationReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import { EntityManager } from "typeorm"
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* x-codegen:
|
||||
* method: addCurrency
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,6 +15,8 @@ import { ModulesHelper } from "../../../../utils/module-helper"
|
||||
* summary: "Get Store details"
|
||||
* description: "Retrieves the Store details"
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -6,6 +6,8 @@ import { PaymentProviderService } from "../../../../services"
|
||||
* summary: "List Payment Providers"
|
||||
* description: "Retrieves the configured Payment Providers"
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: listPaymentProviders
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -6,6 +6,8 @@ import { TaxProviderService } from "../../../../services"
|
||||
* summary: "List Tax Providers"
|
||||
* description: "Retrieves the configured Tax Providers"
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: listTaxProviders
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import { EntityManager } from "typeorm"
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* x-codegen:
|
||||
* method: deleteCurrency
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,6 +15,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostStoreReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -10,6 +10,8 @@ import { SwapService } from "../../../../services"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Swap.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,6 +15,9 @@ import { Swap } from "../../../../models"
|
||||
* - (query) limit=50 {number} The upper limit for the amount of responses returned.
|
||||
* - (query) offset=0 {number} The offset of the list returned.
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetSwapsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateProductTypesReq"
|
||||
* x-codegen:
|
||||
* method: addProductTypes
|
||||
* queryParams: AdminPostTaxRatesTaxRateProductTypesParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateProductsReq"
|
||||
* x-codegen:
|
||||
* method: addProducts
|
||||
* queryParams: AdminPostTaxRatesTaxRateProductsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateShippingOptionsReq"
|
||||
* x-codegen:
|
||||
* method: addShippingOptions
|
||||
* queryParams: AdminPostTaxRatesTaxRateShippingOptionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -39,6 +39,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* queryParams: AdminPostTaxRatesParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { TaxRateService } from "../../../../services"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Shipping Option.
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -31,6 +31,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* items:
|
||||
* type: string
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* queryParams: AdminGetTaxRatesTaxRateParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -71,6 +71,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetTaxRatesParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteTaxRatesTaxRateProductTypesReq"
|
||||
* x-codegen:
|
||||
* method: removeProductTypes
|
||||
* queryParams: AdminDeleteTaxRatesTaxRateProductTypesParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteTaxRatesTaxRateProductsReq"
|
||||
* x-codegen:
|
||||
* method: removeProducts
|
||||
* queryParams: AdminDeleteTaxRatesTaxRateProductsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteTaxRatesTaxRateShippingOptionsReq"
|
||||
* x-codegen:
|
||||
* method: removeShippingOptions
|
||||
* queryParams: AdminDeleteTaxRatesTaxRateShippingOptionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -40,6 +40,9 @@ import { isDefined } from "medusa-core-utils"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* queryParams: AdminPostTaxRatesTaxRateParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminCreateUserRequest"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import UserService from "../../../../services/user"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the User.
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -8,6 +8,8 @@ import UserService from "../../../../services/user"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the User.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -6,6 +6,8 @@ import UserService from "../../../../services/user"
|
||||
* summary: "List Users"
|
||||
* description: "Retrieves all users."
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -14,6 +14,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminResetPasswordTokenRequest"
|
||||
* x-codegen:
|
||||
* method: sendResetPasswordToken
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -19,6 +19,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminResetPasswordRequest"
|
||||
* x-codegen:
|
||||
* method: resetPassword
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,6 +18,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminUpdateUserRequest"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -20,6 +20,8 @@ import { joinLevels } from "../inventory-items/utils/join-levels"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id {string} The Product Variant id to get inventory for.
|
||||
* x-codegen:
|
||||
* method: getInventory
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -64,6 +64,9 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* gte:
|
||||
* type: number
|
||||
* description: filter by inventory quantity greater than or equal to this number
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetVariantsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
Reference in New Issue
Block a user