feat(oas): Improve OAS by adding missing type object to schemas (#3177)
This PR improves the OAS by adding `type: object` to schemas that have `properties` and no `type`. While this attribute is not required for a valid spec, omitting it opens the possibilities of non-object input. See https://stackoverflow.com/a/47390723 for a detailed description of this behavior. When generating code or schemas from an OAS with tools like takeshape.io having `type` attributes is important to get the correct behavior.
This commit is contained in:
@@ -114,6 +114,7 @@ export default async (req: Request, res: Response) => {
|
||||
* description: "The ids of the customers to add"
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
|
||||
@@ -114,6 +114,7 @@ export default async (req: Request, res: Response) => {
|
||||
* description: "The ids of the customers to remove"
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
|
||||
@@ -148,6 +148,7 @@ class Group {
|
||||
* groups:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
|
||||
@@ -121,6 +121,7 @@ export default async (req: Request, res: Response) => {
|
||||
* description: The resources to be added to the discount condition
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
|
||||
+1
@@ -122,6 +122,7 @@ export class AdminDeleteDiscountsDiscountConditionsConditionBatchParams extends
|
||||
* description: The resources to be deleted from the discount condition
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
|
||||
@@ -315,6 +315,7 @@ export default async (req, res) => {
|
||||
* description: The Claim Items that the Claim will consist of.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
@@ -359,6 +360,7 @@ export default async (req, res) => {
|
||||
* description: The new items to send to the Customer when the Claim type is Replace.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
@@ -373,6 +375,7 @@ export default async (req, res) => {
|
||||
* description: The Shipping Methods to send the additional Line Items with.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Shipping Method
|
||||
|
||||
@@ -192,6 +192,7 @@ const updateInventoryAndReservations = async (
|
||||
* description: The Line Items to include in the Fulfillment.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
|
||||
@@ -262,6 +262,7 @@ export default async (req, res) => {
|
||||
* description: The Line Items to return as part of the Swap.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
@@ -294,6 +295,7 @@ export default async (req, res) => {
|
||||
* description: The new items to send to the Customer.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
@@ -308,6 +310,7 @@ export default async (req, res) => {
|
||||
* description: The custom shipping options to potentially create a Shipping Method from.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* - price
|
||||
|
||||
@@ -296,6 +296,7 @@ type ReturnObj = {
|
||||
* description: The Line Items that will be returned.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
|
||||
@@ -112,6 +112,7 @@ export default async (req, res) => {
|
||||
* description: The Claim Items that the Claim will consist of.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* - images
|
||||
@@ -168,6 +169,7 @@ export default async (req, res) => {
|
||||
* description: The Shipping Methods to send the additional Line Items with.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Shipping Method
|
||||
|
||||
@@ -113,6 +113,7 @@ export default async (req, res) => {
|
||||
* description: The prices to update or add.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
|
||||
@@ -157,6 +157,7 @@ class CustomerGroup {
|
||||
* description: The prices of the Price List.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
@@ -186,6 +187,7 @@ class CustomerGroup {
|
||||
* type: array
|
||||
* description: A list of customer groups that the Price List applies to.
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
|
||||
@@ -148,6 +148,7 @@ class CustomerGroup {
|
||||
* description: The prices of the Price List.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
@@ -180,6 +181,7 @@ class CustomerGroup {
|
||||
* type: array
|
||||
* description: A list of customer groups that the Price List applies to.
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
|
||||
@@ -362,6 +362,7 @@ class ProductVariantReq {
|
||||
* description: Tags to associate the Product with.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
@@ -375,6 +376,7 @@ class ProductVariantReq {
|
||||
* description: "[EXPERIMENTAL] Sales channels to associate the Product with."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
@@ -395,6 +397,7 @@ class ProductVariantReq {
|
||||
* description: The Options that the Product should have. These define on which properties the Product's Product Variants will differ.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
@@ -405,6 +408,7 @@ class ProductVariantReq {
|
||||
* description: A list of Product Variants to create with the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
@@ -463,6 +467,7 @@ class ProductVariantReq {
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
@@ -487,6 +492,7 @@ class ProductVariantReq {
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
|
||||
@@ -226,6 +226,7 @@ class ProductVariantOptionReq {
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
@@ -253,6 +254,7 @@ class ProductVariantOptionReq {
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
|
||||
@@ -271,6 +271,7 @@ export type AdminProductsListTypesRes = {
|
||||
* tags:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the tag.
|
||||
|
||||
@@ -368,6 +368,7 @@ class ProductVariantReq {
|
||||
* description: Tags to associate the Product with.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
@@ -381,6 +382,7 @@ class ProductVariantReq {
|
||||
* description: "[EXPERIMENTAL] Sales channels to associate the Product with."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
@@ -401,6 +403,7 @@ class ProductVariantReq {
|
||||
* description: A list of Product Variants to create with the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Product Variant.
|
||||
@@ -459,6 +462,7 @@ class ProductVariantReq {
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
@@ -486,6 +490,7 @@ class ProductVariantReq {
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
|
||||
@@ -207,6 +207,7 @@ class ProductVariantOptionReq {
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
@@ -234,6 +235,7 @@ class ProductVariantOptionReq {
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
|
||||
@@ -147,6 +147,7 @@ class Item {
|
||||
* description: The Line Items that have been received.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
|
||||
@@ -156,6 +156,7 @@ class OptionRequirement {
|
||||
* description: "The requirements that must be satisfied for the Shipping Option to be available."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - amount
|
||||
|
||||
@@ -143,6 +143,7 @@ class OptionRequirement {
|
||||
* description: "The requirements that must be satisfied for the Shipping Option to be available."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - amount
|
||||
|
||||
@@ -209,6 +209,7 @@ export class Item {
|
||||
* description: "An optional array of `variant_id`, `quantity` pairs to generate Line Items from."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
|
||||
@@ -151,6 +151,7 @@ class Discount {
|
||||
* description: "An array of Gift Card codes to add to the Cart."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
@@ -161,6 +162,7 @@ class Discount {
|
||||
* description: "An array of Discount codes to add to the Cart."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
|
||||
+1
@@ -129,6 +129,7 @@ export class StorePostPaymentCollectionsSessionsReq {
|
||||
* description: "An array of payment sessions related to the Payment Collection. If the session_id is not provided, existing sessions not present will be deleted and the provided ones will be created."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - provider_id
|
||||
* - amount
|
||||
|
||||
@@ -264,6 +264,7 @@ class Item {
|
||||
* description: "The items to include in the Return."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
|
||||
@@ -296,6 +296,7 @@ class AdditionalItem {
|
||||
* description: "The items to include in the Return."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
@@ -319,6 +320,7 @@ class AdditionalItem {
|
||||
* description: "The items to exchange the returned items to."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
|
||||
Reference in New Issue
Block a user