Skip to content

Commit b73b2c7

Browse files
authored
chore: OAS for product options (#14344)
1 parent 4e7393a commit b73b2c7

36 files changed

Lines changed: 1936 additions & 274 deletions

www/utils/generated/oas-output/base/admin.oas.base.yaml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,10 @@ tags:
211211
$ref: "#/components/schemas/AdminInvite"
212212
- name: Locales
213213
description: >
214-
A locale is a language that content is translated into for customers to view
215-
in a storefront.
216-
217-
Medusa installs locales by default. These API routes allow admin users to retrieve
218-
and view locales.
214+
A locale is a language that content is translated into for customers to
215+
view in a storefront.
216+
217+
Medusa installs locales by default. These API routes allow admin users to retrieve and view locales.
219218
externalDocs:
220219
description: Learn more about locales and translations.
221220
url: https://docs.medusajs.com/resources/commerce-modules/translation/concepts
@@ -357,6 +356,18 @@ tags:
357356
url: https://docs.medusajs.com/resources/commerce-modules/product
358357
x-associatedSchema:
359358
$ref: "#/components/schemas/AdminProductCategory"
359+
- name: Product Options
360+
x-associatedSchema:
361+
$ref: "#/components/schemas/AdminProductOption"
362+
description: >
363+
A product option is a way to define different options for a product, such
364+
as "Size" or "Color". Product options can be created globally and used by
365+
multiple products, or they can be exclusive to a specific product.
366+
367+
These API routes allow admin users to manage product options.
368+
externalDocs:
369+
description: Learn more about the Product Module
370+
url: https://docs.medusajs.com/resources/commerce-modules/product
360371
- name: Product Tags
361372
description: >
362373
A tag is another way of organizing a product. Each tag has a name and a
@@ -659,8 +670,7 @@ tags:
659670
A translation is a localized version of content in a specific locale. For
660671
example, a product description in French.
661672
662-
These API routes allow admin users to manage translations for different
663-
locales and resources.
673+
These API routes allow admin users to manage translations for different locales and resources.
664674
externalDocs:
665675
description: Learn more about the Translation Module.
666676
url: https://docs.medusajs.com/resources/commerce-modules/translation

www/utils/generated/oas-output/base/store.oas.base.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,10 @@ tags:
8383
$ref: "#/components/schemas/StoreGiftCard"
8484
- name: Locales
8585
description: >
86-
A locale is a language that content is translated into for customers to view
87-
in a storefront.
88-
89-
Medusa installs locales by default. These API routes allow you to retrieve
90-
supported locales in the store.
86+
A locale is a language that content is translated into for customers to
87+
view in a storefront.
88+
89+
Medusa installs locales by default. These API routes allow you to retrieve supported locales in the store.
9190
externalDocs:
9291
description: Learn more about locales and translations.
9392
url: https://docs.medusajs.com/resources/commerce-modules/translation/concepts
@@ -135,6 +134,18 @@ tags:
135134
url: https://docs.medusajs.com/resources/storefront-development/products/categories/list
136135
x-associatedSchema:
137136
$ref: "#/components/schemas/StoreProductCategory"
137+
- name: Product Options
138+
x-associatedSchema:
139+
$ref: "#/components/schemas/StoreProductOption"
140+
description: >
141+
A product option is a way to define different options for a product, such
142+
as "Size" or "Color". Product options can be created globally and used by
143+
multiple products, or they can be exclusive to a specific product.
144+
145+
These API routes allow customers to view product options.
146+
externalDocs:
147+
description: Use Product Options in a Storefront
148+
url: https://docs.medusajs.com/resources/storefront-development/products/options
138149
- name: Product Tags
139150
x-associatedSchema:
140151
$ref: "#/components/schemas/StoreProductTag"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* @oas [delete] /admin/product-options/{id}
3+
* operationId: DeleteProductOptionsId
4+
* summary: Delete a Product Option
5+
* description: Delete a product option.
6+
* x-authenticated: true
7+
* parameters:
8+
* - name: id
9+
* in: path
10+
* description: The product option's ID.
11+
* required: true
12+
* schema:
13+
* type: string
14+
* security:
15+
* - api_token: []
16+
* - cookie_auth: []
17+
* - jwt_token: []
18+
* x-codeSamples:
19+
* - lang: JavaScript
20+
* label: JS SDK
21+
* source: |-
22+
* import Medusa from "@medusajs/js-sdk"
23+
*
24+
* export const sdk = new Medusa({
25+
* baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
26+
* debug: import.meta.env.DEV,
27+
* auth: {
28+
* type: "session",
29+
* },
30+
* })
31+
*
32+
* sdk.admin.productOption.delete("opt_123")
33+
* .then(({ deleted }) => {
34+
* console.log(deleted)
35+
* })
36+
* - lang: Shell
37+
* label: cURL
38+
* source: |-
39+
* curl -X DELETE '{backend_url}/admin/product-options/{id}' \
40+
* -H 'Authorization: Bearer {access_token}'
41+
* tags:
42+
* - Product Options
43+
* responses:
44+
* "200":
45+
* description: OK
46+
* content:
47+
* application/json:
48+
* schema:
49+
* $ref: "#/components/schemas/AdminProductOptionDeleteResponse"
50+
* "400":
51+
* $ref: "#/components/responses/400_error"
52+
* "401":
53+
* $ref: "#/components/responses/unauthorized"
54+
* "404":
55+
* $ref: "#/components/responses/not_found_error"
56+
* "409":
57+
* $ref: "#/components/responses/invalid_state_error"
58+
* "422":
59+
* $ref: "#/components/responses/invalid_request_error"
60+
* "500":
61+
* $ref: "#/components/responses/500_error"
62+
* x-workflow: deleteProductOptionsWorkflow
63+
* x-events:
64+
* - name: product-option.deleted
65+
* payload: |-
66+
* ```ts
67+
* {
68+
* id, // The ID of the product option
69+
* }
70+
* ```
71+
* description: Emitted when product options are deleted.
72+
* deprecated: false
73+
*
74+
*/
75+

www/utils/generated/oas-output/operations/admin/delete_admin_products_[id]_options_[option_id].ts renamed to www/utils/generated/oas-output/operations/admin/get_admin_price-lists_[id]_prices.ts

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,27 @@
11
/**
2-
* @oas [delete] /admin/products/{id}/options/{option_id}
3-
* operationId: DeleteProductsIdOptionsOption_id
4-
* summary: Delete an Option from Product
5-
* x-sidebar-summary: Delete Option
6-
* description: |
7-
* Delete an option from a product.
8-
*
9-
* Values of this option in the product's variants are removed.
2+
* @oas [get] /admin/price-lists/{id}/prices
3+
* operationId: GetPriceListsIdPrices
4+
* summary: List Prices for a Price List
5+
* x-sidebar-summary: List Prices
6+
* description: Retrieve a list of prices in a price list. The prices can be filtered by fields like FILTER FIELDS. The prices can also be paginated.
107
* x-authenticated: true
118
* parameters:
129
* - name: id
1310
* in: path
14-
* description: The product's ID.
15-
* required: true
16-
* schema:
17-
* type: string
18-
* - name: option_id
19-
* in: path
20-
* description: The product option's ID.
11+
* description: The price list's ID.
2112
* required: true
2213
* schema:
2314
* type: string
2415
* - name: fields
2516
* in: query
26-
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
27-
* fields. without prefix it will replace the entire default fields.
17+
* description: Comma-separated fields that should be included in the returned data. If a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
18+
* fields. Without prefix it will replace the entire default fields.
2819
* required: false
2920
* schema:
3021
* type: string
3122
* title: fields
32-
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
33-
* fields. without prefix it will replace the entire default fields.
23+
* description: Comma-separated fields that should be included in the returned data. If a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
24+
* fields. Without prefix it will replace the entire default fields.
3425
* externalDocs:
3526
* url: "#select-fields-and-relations"
3627
* security:
@@ -51,24 +42,24 @@
5142
* },
5243
* })
5344
*
54-
* sdk.admin.product.deleteOption("prod_123", "prodopt_123")
55-
* .then(({ deleted }) => {
56-
* console.log(deleted)
45+
* sdk.admin.priceList.prices("plist_123")
46+
* .then(({ prices }) => {
47+
* console.log(prices)
5748
* })
5849
* - lang: Shell
5950
* label: cURL
6051
* source: |-
61-
* curl -X DELETE '{backend_url}/admin/products/{id}/options/{option_id}' \
62-
* -H 'Authorization: Bearer {jwt_token}'
52+
* curl '{backend_url}/admin/price-lists/{id}/prices' \
53+
* -H 'Authorization: Bearer {access_token}'
6354
* tags:
64-
* - Products
55+
* - Price Lists
6556
* responses:
6657
* "200":
6758
* description: OK
6859
* content:
6960
* application/json:
7061
* schema:
71-
* $ref: "#/components/schemas/AdminProductOptionDeleteResponse"
62+
* $ref: "#/components/schemas/AdminPriceListPriceListResponse"
7263
* "400":
7364
* $ref: "#/components/responses/400_error"
7465
* "401":
@@ -81,17 +72,7 @@
8172
* $ref: "#/components/responses/invalid_request_error"
8273
* "500":
8374
* $ref: "#/components/responses/500_error"
84-
* x-workflow: deleteProductOptionsWorkflow
85-
* x-events:
86-
* - name: product-option.deleted
87-
* payload: |-
88-
* ```ts
89-
* {
90-
* id, // The ID of the product option
91-
* }
92-
* ```
93-
* description: Emitted when product options are deleted.
94-
* deprecated: false
75+
* x-since: 2.12.3
9576
*
9677
*/
9778

0 commit comments

Comments
 (0)