From dd487f02e162e702a93b051217bef56468240b60 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 27 Jan 2025 17:33:46 +0200 Subject: [PATCH] docs-util: fix issue with creating StoreProductType OAS schema (#11180) --- .../components/schemas/StoreProduct.yaml | 2 +- .../components/schemas/StoreProductType.yaml | 35 +++++++++++++++ .../schemas/StoreProductTypeListResponse.yaml | 2 +- .../schemas/StoreProductTypeResponse.yaml | 2 +- .../specs/admin/openapi.full.yaml | 42 ++++++++++++++++-- .../components/schemas/StoreProduct.yaml | 2 +- .../components/schemas/StoreProductType.yaml | 35 +++++++++++++++ .../schemas/StoreProductTypeListResponse.yaml | 2 +- .../schemas/StoreProductTypeResponse.yaml | 2 +- .../specs/store/openapi.full.yaml | 44 +++++++++++++++++-- .../api-reference/specs/store/openapi.yaml | 2 + .../oas-output/base/store.oas.base.yaml | 2 + .../oas-output/schemas/StoreProduct.ts | 2 +- .../oas-output/schemas/StoreProductType.ts | 40 +++++++++++++++++ .../schemas/StoreProductTypeListResponse.ts | 2 +- .../schemas/StoreProductTypeResponse.ts | 2 +- .../src/classes/helpers/oas-schema.ts | 2 +- 17 files changed, 204 insertions(+), 16 deletions(-) create mode 100644 www/apps/api-reference/specs/admin/components/schemas/StoreProductType.yaml create mode 100644 www/apps/api-reference/specs/store/components/schemas/StoreProductType.yaml create mode 100644 www/utils/generated/oas-output/schemas/StoreProductType.ts diff --git a/www/apps/api-reference/specs/admin/components/schemas/StoreProduct.yaml b/www/apps/api-reference/specs/admin/components/schemas/StoreProduct.yaml index da21ace142..137cd220c4 100644 --- a/www/apps/api-reference/specs/admin/components/schemas/StoreProduct.yaml +++ b/www/apps/api-reference/specs/admin/components/schemas/StoreProduct.yaml @@ -35,7 +35,7 @@ properties: items: type: object type: - type: object + $ref: ./StoreProductType.yaml length: type: number title: length diff --git a/www/apps/api-reference/specs/admin/components/schemas/StoreProductType.yaml b/www/apps/api-reference/specs/admin/components/schemas/StoreProductType.yaml new file mode 100644 index 0000000000..ed951b4c13 --- /dev/null +++ b/www/apps/api-reference/specs/admin/components/schemas/StoreProductType.yaml @@ -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. diff --git a/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeListResponse.yaml b/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeListResponse.yaml index 5759dba226..49f0435607 100644 --- a/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeListResponse.yaml +++ b/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeListResponse.yaml @@ -23,4 +23,4 @@ properties: type: array description: The list of product types. items: - $ref: ./StoreProduct.yaml + $ref: ./StoreProductType.yaml diff --git a/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeResponse.yaml b/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeResponse.yaml index 329c131c1d..02c5bb9627 100644 --- a/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeResponse.yaml +++ b/www/apps/api-reference/specs/admin/components/schemas/StoreProductTypeResponse.yaml @@ -5,4 +5,4 @@ required: - product_type properties: product_type: - $ref: ./StoreProduct.yaml + $ref: ./StoreProductType.yaml diff --git a/www/apps/api-reference/specs/admin/openapi.full.yaml b/www/apps/api-reference/specs/admin/openapi.full.yaml index 4cf2c1a588..8b6e370ae6 100644 --- a/www/apps/api-reference/specs/admin/openapi.full.yaml +++ b/www/apps/api-reference/specs/admin/openapi.full.yaml @@ -68679,7 +68679,7 @@ components: items: type: object type: - type: object + $ref: '#/components/schemas/StoreProductType' length: type: number title: length @@ -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. @@ -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. @@ -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. diff --git a/www/apps/api-reference/specs/store/components/schemas/StoreProduct.yaml b/www/apps/api-reference/specs/store/components/schemas/StoreProduct.yaml index da21ace142..137cd220c4 100644 --- a/www/apps/api-reference/specs/store/components/schemas/StoreProduct.yaml +++ b/www/apps/api-reference/specs/store/components/schemas/StoreProduct.yaml @@ -35,7 +35,7 @@ properties: items: type: object type: - type: object + $ref: ./StoreProductType.yaml length: type: number title: length diff --git a/www/apps/api-reference/specs/store/components/schemas/StoreProductType.yaml b/www/apps/api-reference/specs/store/components/schemas/StoreProductType.yaml new file mode 100644 index 0000000000..ed951b4c13 --- /dev/null +++ b/www/apps/api-reference/specs/store/components/schemas/StoreProductType.yaml @@ -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. diff --git a/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeListResponse.yaml b/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeListResponse.yaml index 5759dba226..49f0435607 100644 --- a/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeListResponse.yaml +++ b/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeListResponse.yaml @@ -23,4 +23,4 @@ properties: type: array description: The list of product types. items: - $ref: ./StoreProduct.yaml + $ref: ./StoreProductType.yaml diff --git a/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeResponse.yaml b/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeResponse.yaml index 329c131c1d..02c5bb9627 100644 --- a/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeResponse.yaml +++ b/www/apps/api-reference/specs/store/components/schemas/StoreProductTypeResponse.yaml @@ -5,4 +5,4 @@ required: - product_type properties: product_type: - $ref: ./StoreProduct.yaml + $ref: ./StoreProductType.yaml diff --git a/www/apps/api-reference/specs/store/openapi.full.yaml b/www/apps/api-reference/specs/store/openapi.full.yaml index e5a772d25c..9d26880895 100644 --- a/www/apps/api-reference/specs/store/openapi.full.yaml +++ b/www/apps/api-reference/specs/store/openapi.full.yaml @@ -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. @@ -32624,7 +32626,7 @@ components: items: type: object type: - type: object + $ref: '#/components/schemas/StoreProductType' length: type: number title: length @@ -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. @@ -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. @@ -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. diff --git a/www/apps/api-reference/specs/store/openapi.yaml b/www/apps/api-reference/specs/store/openapi.yaml index ca01ec3f12..361843fbf8 100644 --- a/www/apps/api-reference/specs/store/openapi.yaml +++ b/www/apps/api-reference/specs/store/openapi.yaml @@ -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. diff --git a/www/utils/generated/oas-output/base/store.oas.base.yaml b/www/utils/generated/oas-output/base/store.oas.base.yaml index 0ab8e3d1c5..106bdfb1b8 100644 --- a/www/utils/generated/oas-output/base/store.oas.base.yaml +++ b/www/utils/generated/oas-output/base/store.oas.base.yaml @@ -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. diff --git a/www/utils/generated/oas-output/schemas/StoreProduct.ts b/www/utils/generated/oas-output/schemas/StoreProduct.ts index 5dbf2e186c..65c825224a 100644 --- a/www/utils/generated/oas-output/schemas/StoreProduct.ts +++ b/www/utils/generated/oas-output/schemas/StoreProduct.ts @@ -37,7 +37,7 @@ * items: * $ref: "#/components/schemas/StoreProductCategory" * type: - * $ref: "#/components/schemas/StoreProduct" + * $ref: "#/components/schemas/StoreProductType" * length: * type: number * title: length diff --git a/www/utils/generated/oas-output/schemas/StoreProductType.ts b/www/utils/generated/oas-output/schemas/StoreProductType.ts new file mode 100644 index 0000000000..6e1a8b4ab0 --- /dev/null +++ b/www/utils/generated/oas-output/schemas/StoreProductType.ts @@ -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. + * +*/ + diff --git a/www/utils/generated/oas-output/schemas/StoreProductTypeListResponse.ts b/www/utils/generated/oas-output/schemas/StoreProductTypeListResponse.ts index da6d7d8e38..c886973849 100644 --- a/www/utils/generated/oas-output/schemas/StoreProductTypeListResponse.ts +++ b/www/utils/generated/oas-output/schemas/StoreProductTypeListResponse.ts @@ -25,7 +25,7 @@ * type: array * description: The list of product types. * items: - * $ref: "#/components/schemas/StoreProduct" + * $ref: "#/components/schemas/StoreProductType" * */ diff --git a/www/utils/generated/oas-output/schemas/StoreProductTypeResponse.ts b/www/utils/generated/oas-output/schemas/StoreProductTypeResponse.ts index 42e8f65dc2..850d895f49 100644 --- a/www/utils/generated/oas-output/schemas/StoreProductTypeResponse.ts +++ b/www/utils/generated/oas-output/schemas/StoreProductTypeResponse.ts @@ -7,7 +7,7 @@ * - product_type * properties: * product_type: - * $ref: "#/components/schemas/StoreProduct" + * $ref: "#/components/schemas/StoreProductType" * */ diff --git a/www/utils/packages/docs-generator/src/classes/helpers/oas-schema.ts b/www/utils/packages/docs-generator/src/classes/helpers/oas-schema.ts index 86da95303f..d308ca4940 100644 --- a/www/utils/packages/docs-generator/src/classes/helpers/oas-schema.ts +++ b/www/utils/packages/docs-generator/src/classes/helpers/oas-schema.ts @@ -357,7 +357,7 @@ class OasSchemaHelper { .replace("DTO", "") .replace(this.schemaRefPrefix, "") .replace( - /(?