Skip to content

Commit

Permalink
docs-util: fix issue with creating StoreProductType OAS schema (#11180)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser authored Jan 27, 2025
1 parent 4ccb489 commit dd487f0
Show file tree
Hide file tree
Showing 17 changed files with 204 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ properties:
items:
type: object
type:
type: object
$ref: ./StoreProductType.yaml
length:
type: number
title: length
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
type: object
description: The product type's details.
x-schemaName: StoreProductType
required:
- id
- value
- created_at
- updated_at
properties:
id:
type: string
title: id
description: The product type's ID.
metadata:
type: object
description: The product type's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the product type was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the product type was updated.
deleted_at:
type: string
format: date-time
title: deleted_at
description: The date the product type was deleted.
value:
type: string
title: value
description: The type's value.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ properties:
type: array
description: The list of product types.
items:
$ref: ./StoreProduct.yaml
$ref: ./StoreProductType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ required:
- product_type
properties:
product_type:
$ref: ./StoreProduct.yaml
$ref: ./StoreProductType.yaml
42 changes: 39 additions & 3 deletions www/apps/api-reference/specs/admin/openapi.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68679,7 +68679,7 @@ components:
items:
type: object
type:
type: object
$ref: '#/components/schemas/StoreProductType'
length:
type: number
title: length
Expand Down Expand Up @@ -69116,6 +69116,42 @@ components:
properties:
product_tag:
$ref: '#/components/schemas/StoreProductTag'
StoreProductType:
type: object
description: The product type's details.
x-schemaName: StoreProductType
required:
- id
- value
- created_at
- updated_at
properties:
id:
type: string
title: id
description: The product type's ID.
metadata:
type: object
description: The product type's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the product type was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the product type was updated.
deleted_at:
type: string
format: date-time
title: deleted_at
description: The date the product type was deleted.
value:
type: string
title: value
description: The type's value.
StoreProductTypeListResponse:
type: object
description: The paginated list of product types.
Expand All @@ -69142,7 +69178,7 @@ components:
type: array
description: The list of product types.
items:
$ref: '#/components/schemas/StoreProduct'
$ref: '#/components/schemas/StoreProductType'
StoreProductTypeResponse:
type: object
description: The product type's details.
Expand All @@ -69151,7 +69187,7 @@ components:
- product_type
properties:
product_type:
$ref: '#/components/schemas/StoreProduct'
$ref: '#/components/schemas/StoreProductType'
StoreProductVariant:
type: object
description: The variant's details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ properties:
items:
type: object
type:
type: object
$ref: ./StoreProductType.yaml
length:
type: number
title: length
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
type: object
description: The product type's details.
x-schemaName: StoreProductType
required:
- id
- value
- created_at
- updated_at
properties:
id:
type: string
title: id
description: The product type's ID.
metadata:
type: object
description: The product type's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the product type was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the product type was updated.
deleted_at:
type: string
format: date-time
title: deleted_at
description: The date the product type was deleted.
value:
type: string
title: value
description: The type's value.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ properties:
type: array
description: The list of product types.
items:
$ref: ./StoreProduct.yaml
$ref: ./StoreProductType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ required:
- product_type
properties:
product_type:
$ref: ./StoreProduct.yaml
$ref: ./StoreProductType.yaml
44 changes: 41 additions & 3 deletions www/apps/api-reference/specs/store/openapi.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ tags:
x-associatedSchema:
$ref: '#/components/schemas/StoreProductTag'
- name: Product Types
x-associatedSchema:
$ref: '#/components/schemas/StoreProductType'
- name: Products
description: |
Customers browse products for their purchase.
Expand Down Expand Up @@ -32624,7 +32626,7 @@ components:
items:
type: object
type:
type: object
$ref: '#/components/schemas/StoreProductType'
length:
type: number
title: length
Expand Down Expand Up @@ -33061,6 +33063,42 @@ components:
properties:
product_tag:
$ref: '#/components/schemas/StoreProductTag'
StoreProductType:
type: object
description: The product type's details.
x-schemaName: StoreProductType
required:
- id
- value
- created_at
- updated_at
properties:
id:
type: string
title: id
description: The product type's ID.
metadata:
type: object
description: The product type's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the product type was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the product type was updated.
deleted_at:
type: string
format: date-time
title: deleted_at
description: The date the product type was deleted.
value:
type: string
title: value
description: The type's value.
StoreProductTypeListResponse:
type: object
description: The paginated list of product types.
Expand All @@ -33087,7 +33125,7 @@ components:
type: array
description: The list of product types.
items:
$ref: '#/components/schemas/StoreProduct'
$ref: '#/components/schemas/StoreProductType'
StoreProductTypeResponse:
type: object
description: The product type's details.
Expand All @@ -33096,7 +33134,7 @@ components:
- product_type
properties:
product_type:
$ref: '#/components/schemas/StoreProduct'
$ref: '#/components/schemas/StoreProductType'
StoreProductVariant:
type: object
description: The variant's details.
Expand Down
2 changes: 2 additions & 0 deletions www/apps/api-reference/specs/store/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ tags:
x-associatedSchema:
$ref: ./components/schemas/StoreProductTag.yaml
- name: Product Types
x-associatedSchema:
$ref: ./components/schemas/StoreProductType.yaml
- name: Products
description: >
Customers browse products for their purchase.
Expand Down
2 changes: 2 additions & 0 deletions www/utils/generated/oas-output/base/store.oas.base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ tags:
x-associatedSchema:
$ref: "#/components/schemas/StoreProductTag"
- name: Product Types
x-associatedSchema:
$ref: "#/components/schemas/StoreProductType"
- name: Products
description: >
Customers browse products for their purchase.
Expand Down
2 changes: 1 addition & 1 deletion www/utils/generated/oas-output/schemas/StoreProduct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* items:
* $ref: "#/components/schemas/StoreProductCategory"
* type:
* $ref: "#/components/schemas/StoreProduct"
* $ref: "#/components/schemas/StoreProductType"
* length:
* type: number
* title: length
Expand Down
40 changes: 40 additions & 0 deletions www/utils/generated/oas-output/schemas/StoreProductType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @schema StoreProductType
* type: object
* description: The product type's details.
* x-schemaName: StoreProductType
* required:
* - id
* - value
* - created_at
* - updated_at
* properties:
* id:
* type: string
* title: id
* description: The product type's ID.
* metadata:
* type: object
* description: The product type's metadata, can hold custom key-value pairs.
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The date the product type was created.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The date the product type was updated.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The date the product type was deleted.
* value:
* type: string
* title: value
* description: The type's value.
*
*/

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* type: array
* description: The list of product types.
* items:
* $ref: "#/components/schemas/StoreProduct"
* $ref: "#/components/schemas/StoreProductType"
*
*/

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* - product_type
* properties:
* product_type:
* $ref: "#/components/schemas/StoreProduct"
* $ref: "#/components/schemas/StoreProductType"
*
*/

Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class OasSchemaHelper {
.replace("DTO", "")
.replace(this.schemaRefPrefix, "")
.replace(
/(?<!(AdminProduct|CreateProduct|StoreShippingOption|AdminShippingOption|CreateShippingOption|BaseProduct))Type$/,
/(?<!(AdminProduct|CreateProduct|StoreShippingOption|AdminShippingOption|CreateShippingOption|BaseProduct|StoreProduct))Type$/,
""
)
}
Expand Down

0 comments on commit dd487f0

Please sign in to comment.