chore(oas): replace response with $ref class JSDoc (Store PRO-V) (#3044)

### Scope

Store routes directories PRO to V.

### What

Move inline OAS response schema declaration under their respective class declarations in order to expose them through  `#/components/schemas`. Replace inline OAS response schema with a `$ref` reference pointing to the newly declared schema.

### Why

Having response declared as its own "named" schema will allow OAS code generators to output typed entities/DTO that can be consumed without having to reference the route/operation.

### How

Declare a new @schema JSDoc for each "Res" class used to parse and validate request body. Move the current inline requestBody to the new @schema.

### Test

- Ran OAS validator.
- Ran docs build script.

Expect no visible changes to the documentation.
This commit is contained in:
Patrick
2023-01-17 09:22:10 -05:00
committed by GitHub
parent 0175388835
commit cb1ec0076b
29 changed files with 215 additions and 166 deletions

View File

@@ -216,44 +216,3 @@ export class ProductVariant extends SoftDeletableEntity {
* description: An optional key-value map with additional details
* example: {car: "white"}
*/
/**
* @schema ProductVariantPricesFields
* title: "Product Variant Prices Fields"
* description: "Product Variants Prices Fields that are only available in some requests."
* type: object
* properties:
* original_price:
* type: number
* description: The original price of the variant without any discounted prices applied.
* calculated_price:
* type: number
* description: The calculated price of the variant. Can be a discounted price.
* original_price_incl_tax:
* type: number
* description: The original price of the variant including taxes.
* calculated_price_incl_tax:
* type: number
* description: The calculated price of the variant including taxes.
* original_tax:
* type: number
* description: The taxes applied on the original price.
* calculated_tax:
* type: number
* description: The taxes applied on the calculated price.
* tax_rates:
* type: array
* description: An array of applied tax rates
* items:
* type: object
* properties:
* rate:
* type: number
* description: The tax rate value
* name:
* type: string
* description: The name of the tax rate
* code:
* type: string
* description: The code of the tax rate
*/