From 1c5f1f9d9ea5b3f4d4f764903061d209c0dc0d68 Mon Sep 17 00:00:00 2001 From: p-zielinski <82354717+p-zielinski@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:18:34 +0100 Subject: [PATCH] anyOf to oneOf --- CONTRIBUTING.md | 4 +- .../ASYNC-ACTIONS-API-Async-Action-Object.md | 2 +- .../CAMPAIGNS-API-Campaign-Object.md | 2 +- .../CUSTOMERS-API-Customer-Activity-Object.md | 20 +- .../EXPORTS-API-Export-Object.md | 4 +- .../LOCATIONS-API-Location-Object.md | 2 +- .../LOYALTIES-API-Earning-Rule-Object.md | 8 +- .../LOYALTIES-API-Loyalty-Campaign-Object.md | 6 +- .../LOYALTIES-API-Loyalty-Tier-Object.md | 2 +- ...DATA-SCHEMAS-API-Metadata-Schema-Object.md | 2 +- .../reference-docs/ORDERS-API-Order-Object.md | 2 +- ...LLECTIONS-API-Product-Collection-Object.md | 2 +- .../PROMOTIONS-API-Promotion-Tier-Object.md | 2 +- .../PUBLICATIONS-API-Publication-Object.md | 2 +- ...QUALIFICATIONS-API-Qualification-Object.md | 4 +- .../REDEMPTIONS-API-Redemption-Object.md | 2 +- ...EMPTIONS-API-Rollback-Redemption-Object.md | 2 +- ...COUNTS-API-Stackable-Redemptions-Object.md | 4 +- ...DATION-RULES-API-Validation-Rule-Object.md | 2 +- .../VALIDATIONS-API-Validation-Object.md | 6 +- .../VOUCHERS-API-Voucher-Object.md | 2 +- reference/OpenAPI.json | 206 +++++++++--------- scripts/build-md-tables-from-openapi.ts | 2 +- scripts/src/schema-to-md-table.ts | 152 +++++-------- 24 files changed, 203 insertions(+), 239 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 081e8af15..3fbf968bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,7 +85,7 @@ How to edit OpenAPI file: "GiftCardTransaction": { "title": "Gift Card Transaction", "description": "List of gift card transactions", - "anyOf": [ + "oneOf": [ { "title": "Redemption", "allOf": [ @@ -123,7 +123,7 @@ For example: Good practices: - for literal unions use `enum` -- for types unions, use `anyOf`, +- for types unions, use `oneOf`, - for attributes that may contain `null`, add `"nullable": true` - for dates use `"type": "string", "format": "date-time"` or `"type": "string", "format": "date"` - for the object, add the "required" attribute which should contain a list of required attributes in the object diff --git a/docs/reference-docs/ASYNC-ACTIONS-API-Async-Action-Object.md b/docs/reference-docs/ASYNC-ACTIONS-API-Async-Action-Object.md index 93d64791f..582be0532 100644 --- a/docs/reference-docs/ASYNC-ACTIONS-API-Async-Action-Object.md +++ b/docs/reference-docs/ASYNC-ACTIONS-API-Async-Action-Object.md @@ -14,7 +14,7 @@ order: 1 | id
`string` |

Async action unique ID.

**Example:**

aa_0adad13d6f057f088e

| | type
`string` |

Type of async action.

Available values: `CAMPAIGN.VOUCHERS_IMPORT`, `CAMPAIGN.VOUCHERS_IMPORT_CSV`, `CAMPAIGN.VOUCHERS_UPDATE`, `CAMPAIGN.VOUCHERS_DELETE`, `CAMPAIGN.VOUCHERS_GENERATE`, `CAMPAIGNS.METADATA_KEY_PURGE`, `CUSTOMERS.IMPORT_CSV`, `CUSTOMERS.BULK_UPDATE`, `CUSTOMERS.METADATA_UPDATE`, `CUSTOMERS.METADATA_KEY_PURGE`, `PRODUCTS.BULK_UPDATE`, `PRODUCTS.METADATA_UPDATE`, `PRODUCTS.METADATA_KEY_PURGE`, `PRODUCTS.IMPORT_CSV`, `SKUS.IMPORT_CSV`, `VOUCHERS.IMPORT`, `VOUCHERS.IMPORT_CSV`, `VOUCHERS.BULK_UPDATE`, `VOUCHERS.METADATA_UPDATE`, `VOUCHERS.METADATA_KEY_PURGE`, `ORDERS.IMPORT`, `ORDERS.METADATA_KEY_PURGE` | | status
`string` |

Status of async action. Informs you whether the async action has already been completed.

Available values: `ENQUEUED`, `IN_PROGRESS`, `DONE`, `FAILED` | -| result | Any of: [CAMPAIGN.VOUCHERS_IMPORT](#campaign.vouchers_import), [CAMPAIGN.VOUCHERS_IMPORT_CSV](#campaign.vouchers_import_csv), [CAMPAIGN.VOUCHERS_UPDATE](#campaign.vouchers_update), [CAMPAIGN.VOUCHERS_DELETE](#campaign.vouchers_delete), [CAMPAIGN.VOUCHERS_GENERATE](#campaign.vouchers_generate), [CAMPAIGNS.METADATA_KEY_PURGE](#campaigns.metadata_key_purge), [CUSTOMERS.IMPORT_CSV](#customers.import_csv), [CUSTOMERS.BULK_UPDATE](#customers.bulk_update), [CUSTOMERS.METADATA_UPDATE](#customers.metadata_update), [CUSTOMERS.METADATA_KEY_PURGE](#customers.metadata_key_purge), [PRODUCTS.BULK_UPDATE](#products.bulk_update), [PRODUCTS.METADATA_UPDATE](#products.metadata_update), [PRODUCTS.IMPORT_CSV](#products.import_csv), [SKUS.IMPORT_CSV](#skus.import_csv), [PRODUCTS.METADATA_KEY_PURGE](#products.metadata_key_purge), [VOUCHERS.IMPORT](#vouchers.import), [VOUCHERS.IMPORT_CSV](#vouchers.import_csv), [VOUCHERS.BULK_UPDATE](#vouchers.bulk_update), [VOUCHERS.METADATA_UPDATE](#vouchers.metadata_update), [VOUCHERS.METADATA_KEY_PURGE](#vouchers.metadata_key_purge), [ORDERS.IMPORT](#orders.import), [ORDERS.METADATA_KEY_PURGE](#orders.metadata_key_purge) | +| result | One of: [CAMPAIGN.VOUCHERS_IMPORT](#campaign.vouchers_import), [CAMPAIGN.VOUCHERS_IMPORT_CSV](#campaign.vouchers_import_csv), [CAMPAIGN.VOUCHERS_UPDATE](#campaign.vouchers_update), [CAMPAIGN.VOUCHERS_DELETE](#campaign.vouchers_delete), [CAMPAIGN.VOUCHERS_GENERATE](#campaign.vouchers_generate), [CAMPAIGNS.METADATA_KEY_PURGE](#campaigns.metadata_key_purge), [CUSTOMERS.IMPORT_CSV](#customers.import_csv), [CUSTOMERS.BULK_UPDATE](#customers.bulk_update), [CUSTOMERS.METADATA_UPDATE](#customers.metadata_update), [CUSTOMERS.METADATA_KEY_PURGE](#customers.metadata_key_purge), [PRODUCTS.BULK_UPDATE](#products.bulk_update), [PRODUCTS.METADATA_UPDATE](#products.metadata_update), [PRODUCTS.IMPORT_CSV](#products.import_csv), [SKUS.IMPORT_CSV](#skus.import_csv), [PRODUCTS.METADATA_KEY_PURGE](#products.metadata_key_purge), [VOUCHERS.IMPORT](#vouchers.import), [VOUCHERS.IMPORT_CSV](#vouchers.import_csv), [VOUCHERS.BULK_UPDATE](#vouchers.bulk_update), [VOUCHERS.METADATA_UPDATE](#vouchers.metadata_update), [VOUCHERS.METADATA_KEY_PURGE](#vouchers.metadata_key_purge), [ORDERS.IMPORT](#orders.import), [ORDERS.METADATA_KEY_PURGE](#orders.metadata_key_purge) | | created_at
`string` |

Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.

**Example:**

2022-06-23T11:21:45.578Z

| | updated_at
`string` |

Timestamp representing the date and time when the async action was updated in ISO 8601 format.

**Example:**

2022-06-23T11:21:46.795Z

| | request_id
`string` |

Unique request ID.

**Example:**

v-0b45cee140c3c9b5ca

| diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index 936535fe9..3fe9c1122 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md +++ b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md @@ -144,7 +144,7 @@ All of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md b/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md index b3cdeebbc..3bc503629 100644 --- a/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md +++ b/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md @@ -19,7 +19,7 @@ order: 2 ## Customer Activity Data

Event data object schema.

-Any of: +One of: [Event Customer Confirmed](#event-customer-confirmed), [Event Customer Created](#event-customer-created), [Event Customer Updated](#event-customer-updated), [Event Customer Deleted](#event-customer-deleted), [Event Customer Referred](#event-customer-referred), [Event Customer Custom Event](#event-customer-custom-event), [Event Customer Segment Entered](#event-customer-segment-entered), [Event Customer Segment Left](#event-customer-segment-left), [Event Customer SMS Sent](#event-customer-sms-sent), [Event Customer SMS Recovered](#event-customer-sms-recovered), [Event Customer SMS Failed](#event-customer-sms-failed), [Event Customer Email Sent](#event-customer-email-sent), [Event Customer Email Recovered](#event-customer-email-recovered), [Event Customer Email Failed](#event-customer-email-failed), [Event Customer ActiveCampaign Sent](#event-customer-activecampaign-sent), [Event Customer ActiveCampaign Recovered](#event-customer-activecampaign-recovered), [Event Customer ActiveCampaign Failed](#event-customer-activecampaign-failed), [Event Customer Braze Sent](#event-customer-braze-sent), [Event Customer Braze Recovered](#event-customer-braze-recovered), [Event Customer Braze Failed](#event-customer-braze-failed), [Event Customer Mailchimp Sent](#event-customer-mailchimp-sent), [Event Customer Mailchimp Recovered](#event-customer-mailchimp-recovered), [Event Customer Mailchimp Failed](#event-customer-mailchimp-failed), [Event Customer Intercom Sent](#event-customer-intercom-sent), [Event Customer Intercom Recovered](#event-customer-intercom-recovered), [Event Customer Intercom Failed](#event-customer-intercom-failed), [Event Customer Shopify Sent](#event-customer-shopify-sent), [Event Customer Shopify Recovered](#event-customer-shopify-recovered), [Event Customer Shopify Failed](#event-customer-shopify-failed), [Event Customer Klaviyo Sent](#event-customer-klaviyo-sent), [Event Customer Klaviyo Recovered](#event-customer-klaviyo-recovered), [Event Customer Klaviyo Failed](#event-customer-klaviyo-failed), [Event Customer Batch Sent](#event-customer-batch-sent), [Event Customer Batch Recovered](#event-customer-batch-recovered), [Event Customer Batch Failed](#event-customer-batch-failed), [Event Customer Rewarded](#event-customer-rewarded), [Event Customer Rewarded Loyalty Points](#event-customer-rewarded-loyalty-points), [Event Customer Gift Voucher Balance Added](#event-customer-gift-voucher-balance-added), [Event Customer Loyalty Card Points Added](#event-customer-loyalty-card-points-added), [Event Customer Loyalty Card Points Transferred](#event-customer-loyalty-card-points-transferred), [Event Customer Loyalty Card Points Expired](#event-customer-loyalty-card-points-expired), [Event Customer Voucher Deleted](#event-customer-voucher-deleted), [Event Customer Publication Succeeded](#event-customer-publication-succeeded), [Event Customer Publication Failed](#event-customer-publication-failed), [Event Customer Validation Succeeded](#event-customer-validation-succeeded), [Event Customer Validation Failed](#event-customer-validation-failed), [Event Customer Redemption Succeeded](#event-customer-redemption-succeeded), [Event Customer Redemption Failed](#event-customer-redemption-failed), [Event Customer Redemption Rollback Succeeded](#event-customer-redemption-rollback-succeeded), [Event Customer Redemption Rollback Failed](#event-customer-redemption-rollback-failed), [Event Customer Consents Given](#event-customer-consents-given), [Event Customer Consents Revoked](#event-customer-consents-revoked), [Event Customer Order Canceled](#event-customer-order-canceled), [Event Customer Order Created](#event-customer-order-created), [Event Customer Order Fulfilled](#event-customer-order-fulfilled), [Event Customer Order Paid](#event-customer-order-paid), [Event Customer Order Processing](#event-customer-order-processing), [Event Customer Order Updated](#event-customer-order-updated), [Event Customer Reward Redemptions Created](#event-customer-reward-redemptions-created), [Event Customer Reward Redemptions Pending](#event-customer-reward-redemptions-pending), [Event Customer Reward Redemptions Completed](#event-customer-reward-redemptions-completed), [Event Customer Reward Redemptions Rolled Back](#event-customer-reward-redemptions-rolled-back), [Event Customer Loyalty Updated](#event-customer-loyalty-updated), [Event Customer Loyalty Tier Upgraded](#event-customer-loyalty-tier-upgraded), [Event Customer Loyalty Tier Downgraded](#event-customer-loyalty-tier-downgraded), [Event Customer Loyalty Tier Prolonged](#event-customer-loyalty-tier-prolonged), [Event Customer Loyalty Tier Expiration Changed](#event-customer-loyalty-tier-expiration-changed), [Event Customer Loyalty Tier Joined](#event-customer-loyalty-tier-joined), [Event Customer Loyalty Tier Left](#event-customer-loyalty-tier-left) @@ -691,7 +691,7 @@ All of: All of: 1. [Order Response Base](#order-response-base) -2.

Order Response

AttributesDescription
customerAny of: Customer Response, Customer Id
referrerAny of: Referrer Response, Referrer Id
+2.

Order Response

AttributesDescription
customerOne of: Customer Response, Customer Id
referrerOne of: Referrer Response, Referrer Id
## Voucher Transaction | Attributes | Description | @@ -828,7 +828,7 @@ All of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) @@ -949,7 +949,7 @@ Any of: |:-----|:--------| | id
`string` |

Assigned by the Voucherify API, identifies the earning rule object.

| | created_at
`string` |

Timestamp representing the date and time when the earning rule was created in ISO 8601 format.

| -| loyalty | Any of: [Define fixed amount of points](#define-fixed-amount-of-points), [Calculate points proportionally](#calculate-points-proportionally) | +| loyalty | One of: [Define fixed amount of points](#define-fixed-amount-of-points), [Calculate points proportionally](#calculate-points-proportionally) | | event |

Defines the event which triggers the earning rule to add points to a loyalty card.

See: [Earning Rule Event](#earning-rule-event) | | custom_event
`object` |
AttributesDescription
schema_id
string
| | segment
`object` |

Contains the id of a customer segment. Required for the customer.segment.entered option in event.

AttributesDescription
id
string

Contains a unique identifier of a customer segment. Assigned by the Voucherify API.

| @@ -1014,7 +1014,7 @@ Available values: `POINTS_ACCRUAL`, `POINTS_CANCELLATION`, `POINTS_REDEMPTION`, | order | See: [Order Response](#order-response) | | applicable_to | See: [Applicable To](#applicable-to) | | inapplicable_to | See: [Inapplicable To](#inapplicable-to) | -| result |

Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.

Any of: [Coupon Code](#coupon-code), [Gift Card](#gift-card), [Loyalty Card](#loyalty-card), [Promotion Tier](#promotion-tier), [Promotion Stack](#promotion-stack) | +| result |

Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.

One of: [Coupon Code](#coupon-code), [Gift Card](#gift-card), [Loyalty Card](#loyalty-card), [Promotion Tier](#promotion-tier), [Promotion Stack](#promotion-stack) | | metadata
`object` |

The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable.

| | categories
`array` | Array of [Category](#category) | @@ -1209,7 +1209,7 @@ All of: | total
`integer` |

Total number of validation rule assignments.

| ## MappingPoints -Any of: +One of: [MappingMultiply](#mappingmultiply), [MappingFixed](#mappingfixed) @@ -1220,7 +1220,7 @@ Any of: | points
`integer` |

Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.

| ## Calculate points proportionally -Any of: +One of: [Order](#order), [Order Items](#order-items), [Customer Metadata](#customer-metadata), [Custom Event](#custom-event) @@ -1301,7 +1301,7 @@ All of: ## Promotion Tier | Attributes | Description | |:-----|:--------| -| discount |

Discount details about the type of discount to be applied for the redeemable.

Any of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) | +| discount |

Discount details about the type of discount to be applied for the redeemable.

One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) | ## Promotion Stack | Attributes | Description | @@ -1429,12 +1429,12 @@ One of: | points
`integer` |

Fixed number of points to be applied.

| ## Order -Any of: +One of: [Order Amount](#order-amount), [Order Total Amount](#order-total-amount), [Order Metadata](#order-metadata) ## Order Items -Any of: +One of: [Order Items Quantity](#order-items-quantity), [Order Items Amount](#order-items-amount), [Order Items Subtotal Amount](#order-items-subtotal-amount) diff --git a/docs/reference-docs/EXPORTS-API-Export-Object.md b/docs/reference-docs/EXPORTS-API-Export-Object.md index 54ba16769..02918478e 100644 --- a/docs/reference-docs/EXPORTS-API-Export-Object.md +++ b/docs/reference-docs/EXPORTS-API-Export-Object.md @@ -12,7 +12,7 @@ order: 1 All of: 1. [Export Base](#export-base) -2. Any of: [Export Vouchers](#export-vouchers), [Export Redemptions](#export-redemptions), [Export Customers](#export-customers), [Export Publications](#export-publications), [Export Orders](#export-orders), [Export Points Expirations](#export-points-expirations), [Export Vouchers Transactions Expiration](#export-vouchers-transactions-expiration) +2. One of: [Export Vouchers](#export-vouchers), [Export Redemptions](#export-redemptions), [Export Customers](#export-customers), [Export Publications](#export-publications), [Export Orders](#export-orders), [Export Points Expirations](#export-points-expirations), [Export Vouchers Transactions Expiration](#export-vouchers-transactions-expiration) ## Export Base | Attributes | Description | @@ -298,7 +298,7 @@ Available values: `and`, `AND`, `or`, `OR` | $count_more | See: [Any](#any) | ## Any -Any of: +One of: 1. Array any of: string, number, object 2. string diff --git a/docs/reference-docs/LOCATIONS-API-Location-Object.md b/docs/reference-docs/LOCATIONS-API-Location-Object.md index fedf14fff..72242f5e5 100644 --- a/docs/reference-docs/LOCATIONS-API-Location-Object.md +++ b/docs/reference-docs/LOCATIONS-API-Location-Object.md @@ -14,7 +14,7 @@ order: 1 | id
`string` |

Unique location ID, assigned by the Voucherify API.

**Example:**

loc_NoMGXmHO9OUs7iz9mGWpamma

| | object
`string` |

The type of object represented by JSON. This object stores information about a location.

| | name
`string` |

Location name.

| -| shape
`object` |

Defines the shape and boundaries of the location.

Any of: [Circle](#circle), [Polygon](#polygon) | +| shape
`object` |

Defines the shape and boundaries of the location.

One of: [Circle](#circle), [Polygon](#polygon) | | created_at
`string` |

Timestamp representing the date and time when the location was created in ISO 8601 format.

**Example:**

2022-02-14T15:12:06.817Z

| | updated_at
`string` |

Timestamp representing the date and time when the location was updated in ISO 8601 format.

**Example:**

2022-03-14T15:12:06.817Z

| diff --git a/docs/reference-docs/LOYALTIES-API-Earning-Rule-Object.md b/docs/reference-docs/LOYALTIES-API-Earning-Rule-Object.md index 960f469e7..54ece1614 100644 --- a/docs/reference-docs/LOYALTIES-API-Earning-Rule-Object.md +++ b/docs/reference-docs/LOYALTIES-API-Earning-Rule-Object.md @@ -19,7 +19,7 @@ All of: |:-----|:--------| | id
`string` |

Assigned by the Voucherify API, identifies the earning rule object.

| | created_at
`string` |

Timestamp representing the date and time when the earning rule was created in ISO 8601 format.

| -| loyalty | Any of: [Define fixed amount of points](#define-fixed-amount-of-points), [Calculate points proportionally](#calculate-points-proportionally) | +| loyalty | One of: [Define fixed amount of points](#define-fixed-amount-of-points), [Calculate points proportionally](#calculate-points-proportionally) | | event |

Defines the event which triggers the earning rule to add points to a loyalty card.

See: [Earning Rule Event](#earning-rule-event) | | custom_event
`object` |
AttributesDescription
schema_id
string
| | segment
`object` |

Contains the id of a customer segment. Required for the customer.segment.entered option in event.

AttributesDescription
id
string

Contains a unique identifier of a customer segment. Assigned by the Voucherify API.

| @@ -39,7 +39,7 @@ All of: | points
`integer` |

Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.

| ## Calculate points proportionally -Any of: +One of: [Order](#order), [Order Items](#order-items), [Customer Metadata](#customer-metadata), [Custom Event](#custom-event) @@ -47,12 +47,12 @@ Any of: Available values: `order.paid`, `customer.segment.entered`, `custom_event`, `customer.loyalty.tier.upgraded`, `customer.loyalty.tier.downgraded`, `customer.loyalty.tier.prolonged`, `customer.loyalty.tier.joined`, `customer.loyalty.tier.left` ## Order -Any of: +One of: [Order Amount](#order-amount), [Order Total Amount](#order-total-amount), [Order Metadata](#order-metadata) ## Order Items -Any of: +One of: [Order Items Quantity](#order-items-quantity), [Order Items Amount](#order-items-amount), [Order Items Subtotal Amount](#order-items-subtotal-amount) diff --git a/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md b/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md index 5c75f492e..c66a99d4a 100644 --- a/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md +++ b/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md @@ -35,7 +35,7 @@ order: 1 | protected
`boolean` |

Indicates whether the resource can be deleted.

| | category_id
`string` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| | categories | See: [Category](#category) | -| loyalty_tiers_expiration
`object` |

Defines the expiration mechanism for loyalty tiers.

Any of: [Balance](#balance), [Points in Period](#points-in-period) | +| loyalty_tiers_expiration
`object` |

Defines the expiration mechanism for loyalty tiers.

One of: [Balance](#balance), [Points in Period](#points-in-period) | | object
`string` |

The type of object represented by JSON. This object stores information about the campaign.

| ## Loyalty Card @@ -63,7 +63,7 @@ order: 1 |:-----|:--------| | qualification_type
`string` |

Tier qualification.

BALANCE: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier.

Available values: `BALANCE` | | start_date
`object` |

Defines the conditions for the start date of the tier.

AttributesDescription
type
string

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.

Available values: IMMEDIATE
| -| expiration_date |

Defines the conditions for the expiration date of a tier.

Any of: [Balance Drop](#balance-drop), [Custom](#custom) | +| expiration_date |

Defines the conditions for the expiration date of a tier.

One of: [Balance Drop](#balance-drop), [Custom](#custom) | ## Points in Period | Attributes | Description | @@ -83,7 +83,7 @@ order: 1 |:-----|:--------| | type
`string` |

What triggers the tier to expire for a customer.
CUSTOM: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.

Available values: `CUSTOM` | | extend
`string` |

Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months.

| -| rounding |

Defines the rounding mechanism for tier expiration.

Any of: [Calendar Periods](#calendar-periods), [Specific Month](#specific-month) | +| rounding |

Defines the rounding mechanism for tier expiration.

One of: [Calendar Periods](#calendar-periods), [Specific Month](#specific-month) | ## Calendar Periods | Attributes | Description | diff --git a/docs/reference-docs/LOYALTIES-API-Loyalty-Tier-Object.md b/docs/reference-docs/LOYALTIES-API-Loyalty-Tier-Object.md index cf9e340bb..baa5fc784 100644 --- a/docs/reference-docs/LOYALTIES-API-Loyalty-Tier-Object.md +++ b/docs/reference-docs/LOYALTIES-API-Loyalty-Tier-Object.md @@ -34,7 +34,7 @@ All of: | updated_at
`string` |

Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format.

**Example:**

2021-12-22T10:13:06.487Z

| ## MappingPoints -Any of: +One of: [MappingMultiply](#mappingmultiply), [MappingFixed](#mappingfixed) diff --git a/docs/reference-docs/METADATA-SCHEMAS-API-Metadata-Schema-Object.md b/docs/reference-docs/METADATA-SCHEMAS-API-Metadata-Schema-Object.md index 30dd15ff5..e4da60845 100644 --- a/docs/reference-docs/METADATA-SCHEMAS-API-Metadata-Schema-Object.md +++ b/docs/reference-docs/METADATA-SCHEMAS-API-Metadata-Schema-Object.md @@ -13,7 +13,7 @@ order: 1 |:-----|:--------| | id
`string` |

Unique metadata schema ID.

**Example:**

ms_OF36L2rk4EqhdxvZs56IW9iE

| | related_object
`string` |

The resource type. There is an infinite number of possibilities for the resource type because you can define custom metadata schemas. Some examples are included here to show you the standard metadata schema resource types.

Available values: `campaign`, `customer`, `earning_rule`, `loyalty_tier`, `order`, `order_item`, `product`, `promotion_tier`, `publication`, `redemption`, `reward`, `voucher` | -| properties
`object` |

Contains the metadata definitions. There can be many properties within this object.

Any of:
AttributesDescription
custom_property_name
object

Custom property name. This is defined in Project Settings > Metadata Schema in the Dashboard.

AttributesDescription
type
string
Available values: string, number, object, date, datetime, geopoint, boolean, image_url
array
boolean

Indicates whether the definition is an array.

optional
boolean

Indicates whether this definition is optional or not optional for the resource.

objectType
string,null

Returns the name of the custom resource if the resource was previously defined in the Dashboard as a custom (non-standard) Nested object.

eq
array

Array of possible values when the setting for is equal to any of in the Dashboard is defined explicitly.

ne
array

Array of values that are not allowed when the setting for is not equal to any of in the Dashboard is defined explicitly.

lt
integer

A property of number type must have less than this value.

lte
integer

A property of number type must be less than or equal to this value.

gt
integer

A property of number type must be greater than this value.

gte
integer

A property of number type must be greater than or equal to this value.

deleted
boolean

Indicates whether the definition was deleted from the schema.

maxLength
integer

Value for maximum length when the setting for has maximum length of in the Dashboard is defined explicitly.

minLength
integer

Value indicating minimum length when the setting for has minimum length of in the Dashboard is defined explicitly.

exactLength
integer

Value indicating exact length when the setting for has exact length of in the Dashboard is defined explicitly.

| +| properties
`object` |

Contains the metadata definitions. There can be many properties within this object.

One of:
AttributesDescription
custom_property_name
object

Custom property name. This is defined in Project Settings > Metadata Schema in the Dashboard.

AttributesDescription
type
string
Available values: string, number, object, date, datetime, geopoint, boolean, image_url
array
boolean

Indicates whether the definition is an array.

optional
boolean

Indicates whether this definition is optional or not optional for the resource.

objectType
string,null

Returns the name of the custom resource if the resource was previously defined in the Dashboard as a custom (non-standard) Nested object.

eq
array

Array of possible values when the setting for is equal to any of in the Dashboard is defined explicitly.

ne
array

Array of values that are not allowed when the setting for is not equal to any of in the Dashboard is defined explicitly.

lt
integer

A property of number type must have less than this value.

lte
integer

A property of number type must be less than or equal to this value.

gt
integer

A property of number type must be greater than this value.

gte
integer

A property of number type must be greater than or equal to this value.

deleted
boolean

Indicates whether the definition was deleted from the schema.

maxLength
integer

Value for maximum length when the setting for has maximum length of in the Dashboard is defined explicitly.

minLength
integer

Value indicating minimum length when the setting for has minimum length of in the Dashboard is defined explicitly.

exactLength
integer

Value indicating exact length when the setting for has exact length of in the Dashboard is defined explicitly.

| | allow_defined_only
`boolean` |

Restricts the creation of metadata fields when set to true. In other words, it indicates whether or not you are allowed to create new metadata definitions; for example, in the campaign manager or publication manager. If it is set to true, then only the defined fields will be available for assigning values.

| | created_at
`string` |

Timestamp representing the date and time when the metadata schema was created in ISO 8601 format.

**Example:**

2021-12-03T13:33:44.556Z

| | updated_at
`string` |

Timestamp representing the date and time when the metadata schema was updated in ISO 8601 format.

**Example:**

2022-08-11T08:05:30.695Z

| diff --git a/docs/reference-docs/ORDERS-API-Order-Object.md b/docs/reference-docs/ORDERS-API-Order-Object.md index 27abc7227..3337606ea 100644 --- a/docs/reference-docs/ORDERS-API-Order-Object.md +++ b/docs/reference-docs/ORDERS-API-Order-Object.md @@ -12,7 +12,7 @@ order: 1 All of: 1. [Order Response Base](#order-response-base) -2.

Order Response

AttributesDescription
customerAny of: Customer Response, Customer Id
referrerAny of: Referrer Response, Referrer Id
+2.

Order Response

AttributesDescription
customerOne of: Customer Response, Customer Id
referrerOne of: Referrer Response, Referrer Id
## Order Response Base | Attributes | Description | diff --git a/docs/reference-docs/PRODUCT-COLLECTIONS-API-Product-Collection-Object.md b/docs/reference-docs/PRODUCT-COLLECTIONS-API-Product-Collection-Object.md index a75bacb98..e3e71eb8b 100644 --- a/docs/reference-docs/PRODUCT-COLLECTIONS-API-Product-Collection-Object.md +++ b/docs/reference-docs/PRODUCT-COLLECTIONS-API-Product-Collection-Object.md @@ -57,7 +57,7 @@ Available values: `and`, `AND`, `or`, `OR` | $count_more | See: [Any](#any) | ## Any -Any of: +One of: 1. Array any of: string, number, object 2. string diff --git a/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md b/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md index 6c576e08f..3fd64f58e 100644 --- a/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md +++ b/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md @@ -36,7 +36,7 @@ order: 1 ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/docs/reference-docs/PUBLICATIONS-API-Publication-Object.md b/docs/reference-docs/PUBLICATIONS-API-Publication-Object.md index 78d399ffa..f1f00c5ef 100644 --- a/docs/reference-docs/PUBLICATIONS-API-Publication-Object.md +++ b/docs/reference-docs/PUBLICATIONS-API-Publication-Object.md @@ -99,7 +99,7 @@ All of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/docs/reference-docs/QUALIFICATIONS-API-Qualification-Object.md b/docs/reference-docs/QUALIFICATIONS-API-Qualification-Object.md index 8c00de9a4..851081566 100644 --- a/docs/reference-docs/QUALIFICATIONS-API-Qualification-Object.md +++ b/docs/reference-docs/QUALIFICATIONS-API-Qualification-Object.md @@ -34,7 +34,7 @@ order: 1 All of: 1. [Order Response Base](#order-response-base) -2.

Order Response

AttributesDescription
customerAny of: Customer Response, Customer Id
referrerAny of: Referrer Response, Referrer Id
+2.

Order Response

AttributesDescription
customerOne of: Customer Response, Customer Id
referrerOne of: Referrer Response, Referrer Id
## Examine Qualification Stacking Rules | Attributes | Description | @@ -247,7 +247,7 @@ All of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/docs/reference-docs/REDEMPTIONS-API-Redemption-Object.md b/docs/reference-docs/REDEMPTIONS-API-Redemption-Object.md index 8fa984bf9..93e6f3a28 100644 --- a/docs/reference-docs/REDEMPTIONS-API-Redemption-Object.md +++ b/docs/reference-docs/REDEMPTIONS-API-Redemption-Object.md @@ -169,7 +169,7 @@ All of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/docs/reference-docs/REDEMPTIONS-API-Rollback-Redemption-Object.md b/docs/reference-docs/REDEMPTIONS-API-Rollback-Redemption-Object.md index b54d2ac51..42b5020a5 100644 --- a/docs/reference-docs/REDEMPTIONS-API-Rollback-Redemption-Object.md +++ b/docs/reference-docs/REDEMPTIONS-API-Rollback-Redemption-Object.md @@ -170,7 +170,7 @@ All of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md b/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md index b9752d049..7d445fd91 100644 --- a/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md +++ b/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md @@ -48,7 +48,7 @@ order: 3 All of: 1. [Order Response Base](#order-response-base) -2.

Order Response

AttributesDescription
customerAny of: Customer Response, Customer Id
referrerAny of: Referrer Response, Referrer Id
+2.

Order Response

AttributesDescription
customerOne of: Customer Response, Customer Id
referrerOne of: Referrer Response, Referrer Id
## Inapplicable Redeemable | Attributes | Description | @@ -222,7 +222,7 @@ All of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Object.md b/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Object.md index cb4e92b40..326cb4ace 100644 --- a/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Object.md +++ b/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Object.md @@ -52,7 +52,7 @@ order: 1 | $from | See: [Any](#any) | ## Any -Any of: +One of: 1. Array any of: string, number, object 2. string diff --git a/docs/reference-docs/VALIDATIONS-API-Validation-Object.md b/docs/reference-docs/VALIDATIONS-API-Validation-Object.md index 63a6b85aa..c1a0dd32e 100644 --- a/docs/reference-docs/VALIDATIONS-API-Validation-Object.md +++ b/docs/reference-docs/VALIDATIONS-API-Validation-Object.md @@ -9,7 +9,7 @@ order: 3 --- ## Vouchers Validate Response Body -Any of: +One of: [Valid Voucher](#valid-voucher), [Invalid Voucher](#invalid-voucher) @@ -63,7 +63,7 @@ Any of: ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) @@ -78,7 +78,7 @@ Any of: All of: 1. [Order Response Base](#order-response-base) -2.

Order Response

AttributesDescription
customerAny of: Customer Response, Customer Id
referrerAny of: Referrer Response, Referrer Id
+2.

Order Response

AttributesDescription
customerOne of: Customer Response, Customer Id
referrerOne of: Referrer Response, Referrer Id
## Session | Attributes | Description | diff --git a/docs/reference-docs/VOUCHERS-API-Voucher-Object.md b/docs/reference-docs/VOUCHERS-API-Voucher-Object.md index c4a26c7f5..116adff69 100644 --- a/docs/reference-docs/VOUCHERS-API-Voucher-Object.md +++ b/docs/reference-docs/VOUCHERS-API-Voucher-Object.md @@ -55,7 +55,7 @@ order: 1 ## Discount

Contains information about discount.

-Any of: +One of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index be9a16adc..100982583 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -414,7 +414,7 @@ "VouchersValidateRequestBody": { "title": "Validate Voucher Request Body", "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/VouchersValidateDiscountRequestBody" }, @@ -743,7 +743,7 @@ "description": "Order information.", "properties": { "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/CustomerResponse", "description": "This is an object containing information about the customer." @@ -755,7 +755,7 @@ ] }, "referrer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/ReferrerResponse", "description": "This is an object containing information about the referrer." @@ -5855,7 +5855,7 @@ "voucher_transaction": { "title": "Voucher Transaction Object", "description": "List of voucher transactions", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/gift_card_transaction" }, @@ -5867,7 +5867,7 @@ "gift_card_transaction": { "title": "Gift Card Transaction", "description": "List of gift card transactions", - "anyOf": [ + "oneOf": [ { "title": "Redemption", "allOf": [ @@ -6621,7 +6621,7 @@ "type": "array", "description": "Request body schema for **POST** `/vouchers/import`.", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/1_obj_vouchers_import_gift_voucher" }, @@ -6724,7 +6724,7 @@ "default": "DISCOUNT_VOUCHER" }, "discount": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/1_obj_vouchers_import_discount_amount" }, @@ -6785,7 +6785,7 @@ "title": "Discount", "type": "object", "description": "Contains information about discount.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/DiscountAmount" }, @@ -6969,7 +6969,7 @@ "type": "array", "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity.", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" }, @@ -7820,7 +7820,7 @@ }, "expiration_date": { "description": "Defines the conditions for the expiration date of a tier.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_balance_drop" }, @@ -7863,7 +7863,7 @@ }, "rounding": { "description": "Defines the rounding mechanism for tier expiration.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_default_options" }, @@ -8702,7 +8702,7 @@ "examples": [], "properties": { "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, @@ -8716,7 +8716,7 @@ "description": "Customer's information." }, "order": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, @@ -8810,7 +8810,7 @@ ] }, "voucher": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" }, @@ -9942,7 +9942,7 @@ "description": "Contains details about the discount applied by the promotion tier.", "properties": { "discount": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" }, @@ -10043,7 +10043,7 @@ "description": "Contains details about the discount applied by the promotion tier.", "properties": { "discount": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" }, @@ -10274,7 +10274,7 @@ "properties": { "campaign": { "description": "Objects stores information about the campaign related to the reward.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS" }, @@ -10411,7 +10411,7 @@ "4_req_create_reward": { "title": "Create Reward Request Body", "description": "Request body schema for **POST** `/rewards`.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/4_req_create_reward_CAMPAIGN" }, @@ -10519,7 +10519,7 @@ "4_req_update_reward": { "title": "Update Reward Request Body", "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/4_req_update_reward_CAMPAIGN" }, @@ -10654,7 +10654,7 @@ "properties": { "campaign": { "description": "Objects stores information about the campaign related to the reward.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM" }, @@ -12097,7 +12097,7 @@ "description": "Defines how the discount is applied to the customer's order." }, "units": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product_multiple" }, @@ -12264,7 +12264,7 @@ "6_res_validate_voucher": { "title": "Valid", "description": "Response schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" }, @@ -12303,7 +12303,7 @@ "description": "Voucher code." }, "discount": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" }, @@ -12528,7 +12528,7 @@ "type": "array", "description": "Contains array of items to which the discount can apply.", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_product_collection" }, @@ -12584,7 +12584,7 @@ "description": "Contains array of items to which the discount cannot apply.", "type": "array", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_product_collection_excluded" }, @@ -13529,7 +13529,7 @@ "description": "Request schema model for validating a promotion using **POST** `/promotions/validation`.", "properties": { "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, @@ -13543,7 +13543,7 @@ "description": "Customer's information." }, "order": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, @@ -13638,7 +13638,7 @@ "example": "Get 45% off items" }, "discount": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" }, @@ -13744,7 +13744,7 @@ "description": "Request schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", "properties": { "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, @@ -13758,7 +13758,7 @@ "description": "Customer's information." }, "order": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, @@ -13780,7 +13780,7 @@ "6_res_validate_promotion_tier": { "title": "Validate Promotion Tier Response Body", "description": "Response schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_promotion_tier_true" }, @@ -13826,7 +13826,7 @@ "example": "Get 45% off items" }, "discount": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" }, @@ -13932,7 +13932,7 @@ }, "error": { "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_promotion_tier_false_custom_message" }, @@ -13960,7 +13960,7 @@ "example": "Get 25% off" }, "discount": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" }, @@ -14546,7 +14546,7 @@ "maxItems": 5, "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/RedeemVoucher" }, @@ -14702,7 +14702,7 @@ }, "result": { "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/RedeemableResultVoucherCode" }, @@ -14807,7 +14807,7 @@ "type": "array", "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/ValidationsRedeemableApplicable" }, @@ -14952,7 +14952,7 @@ "properties": { "discount": { "description": "Discount details about the type of discount to be applied for the redeemable.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/DiscountAmount" }, @@ -15037,7 +15037,7 @@ }, "order": { "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" }, @@ -15173,7 +15173,7 @@ }, "order": { "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" }, @@ -15184,7 +15184,7 @@ }, "reward": { "description": "Defines the reward that was initially redeemed.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" }, @@ -15333,7 +15333,7 @@ }, "order": { "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" }, @@ -15476,7 +15476,7 @@ }, "order": { "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" }, @@ -16477,7 +16477,7 @@ "7_obj_redemption_object": { "title": "Redemption Object", "description": "This is an object representing a redemption. \n\nRedemption is the key operation in the voucher and promotion tier lifecycle. A customer can redeem a voucher or promotion tier once or multiple times depending on selected limit (`quantity`). Each redemption is recorded in voucher/promotion's history (`redemption_entries`). There is also an option to cancel a redemption. We call such an operation a [redemption rollback](ref:rollback-redemption).", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" }, @@ -16507,7 +16507,7 @@ "7_obj_redemption_object_voucher": { "title": "Redemption Object", "description": "This is an object representing an attempted or successful voucher redemption.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" }, @@ -16537,7 +16537,7 @@ "7_obj_redemption_object_voucher_extended": { "title": "Redemption Object", "description": "This is an object representing an attempted or successful voucher redemption.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended" }, @@ -17414,7 +17414,7 @@ }, "reward": { "description": "Defines the reward being redeemed.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" }, @@ -17573,7 +17573,7 @@ "7_obj_rollback_redemption_object_truncated": { "title": "Rollback Redemption Object", "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" }, @@ -17597,7 +17597,7 @@ "7_obj_rollback_redemption_object_extended": { "title": "Rollback Redemption Object", "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_rollback_redemption_object_discount_voucher_extended" }, @@ -17860,7 +17860,7 @@ }, "reward": { "description": "Defines the reward being redeemed.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" }, @@ -18587,7 +18587,7 @@ }, "reward": { "description": "Defines the reward that was initially redeemed.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" }, @@ -18757,7 +18757,7 @@ }, "reward": { "description": "Defines the reward being redeemed.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" }, @@ -19164,7 +19164,7 @@ "properties": { "campaign": { "description": "Defines the source of the digital reward.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_discount_voucher" }, @@ -20765,7 +20765,7 @@ } }, "RedemptionsGetResponseBody": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/Redemption" }, @@ -20794,7 +20794,7 @@ "redemptions": { "type": "array", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/Redemption" }, @@ -20892,7 +20892,7 @@ "type": "array", "description": "Contains the array of successful and failed redemption objects.", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/Redemption" }, @@ -20908,7 +20908,7 @@ "7_req_redeem_voucher": { "title": "Redeem Voucher Request Body", "description": "Request body schema for redeeming a voucher using **POST** `/vouchers/{code}/redemption`.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_req_redeem_voucher_discount_code" }, @@ -20931,7 +20931,7 @@ "description": "Redeem a promotion tier.", "properties": { "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, @@ -20945,7 +20945,7 @@ "description": "Customer's information." }, "order": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, @@ -20973,7 +20973,7 @@ "$ref": "#/components/schemas/6_req_session_lock_discount_code" }, "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, @@ -20987,7 +20987,7 @@ "description": "Customer's information." }, "order": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, @@ -21042,7 +21042,7 @@ } }, "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, @@ -21056,7 +21056,7 @@ "description": "Customer's information." }, "order": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, @@ -21115,7 +21115,7 @@ } }, "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, @@ -21129,7 +21129,7 @@ "description": "Customer's information." }, "order": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, @@ -21342,7 +21342,7 @@ "loyalty_tiers_expiration": { "type": "object", "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" }, @@ -21507,7 +21507,7 @@ "loyalty_tiers_expiration": { "type": "object", "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" }, @@ -22465,7 +22465,7 @@ "metadata": {} } ], - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid" }, @@ -23842,7 +23842,7 @@ "8_obj_calculate_points_proportionally_order_paid": { "title": "Calculate Points Proportionally", "description": "This is an object representing points calculated proportionally to another property.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_amounts" }, @@ -24354,7 +24354,7 @@ "loyalty_tiers_expiration": { "type": "object", "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" }, @@ -24408,7 +24408,7 @@ }, "expiration_date": { "description": "Defines the conditions for the expiration date of a tier.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_balance_drop" }, @@ -24557,7 +24557,7 @@ }, "rounding": { "description": "Defines the rounding mechanism for tier expiration.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_default_options" }, @@ -24731,7 +24731,7 @@ "loyalty_tiers_expiration": { "type": "object", "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" }, @@ -24798,7 +24798,7 @@ "title": "Create Earning Rule Request Body", "type": "array", "items": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_req_earning_rule_object_order_paid" }, @@ -24817,7 +24817,7 @@ "8_req_update_earning_rule": { "description": "Request body schema for updating earning rules using **PUT** `/loyalties/{campaignId}/earning-rules/{earningRuleId}` endpoint.", "title": "Update Earning Rule Request Body", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_req_update_earning_rule_object_order_paid" }, @@ -25039,7 +25039,7 @@ }, "reward": { "description": "Defines the reward being redeemed.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" }, @@ -25133,7 +25133,7 @@ }, "filters": { "description": "Data filters used to narrow the data records to be returned in the export.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_req_filter_campaign_id" }, @@ -25187,7 +25187,7 @@ }, "filters": { "description": "Data filters used to narrow the data records to be returned in the export.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_req_filter_campaign_id" }, @@ -25437,7 +25437,7 @@ "description": "Specify the distribution channel." }, "customer": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/8_req_customer_id_string" }, @@ -25999,7 +25999,7 @@ "CustomerActivityData": { "title": "Customer Activity Data", "description": "Event data object schema.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/EventCustomerConfirmed" }, @@ -29930,7 +29930,7 @@ } }, "filters": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/16_obj_filter_order_status" }, @@ -30064,7 +30064,7 @@ }, "filters": { "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `failure_code`\n\n - `result`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `voucher_type`\n\n - `is_referral_code`\n\n - `parent_object_id`\n\n - `related_object_id`\n\n - `source_id`", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/16_obj_filter_publication_failure_code" }, @@ -30253,7 +30253,7 @@ }, "filters": { "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `campaign_id`\n\n - `voucher_id`", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/16_obj_filter_points_expiration_campaign_id" }, @@ -30862,7 +30862,7 @@ ] }, "result": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import" }, @@ -32107,7 +32107,7 @@ }, "properties": { "description": "Contains the metadata definitions. There can be many properties within this object.", - "anyOf": [ + "oneOf": [ { "properties": { "custom_property_name": { @@ -33302,7 +33302,7 @@ "shape": { "type": "object", "description": "Defines the shape and boundaries of the location.", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/22_obj_location_object_shape_circle" }, @@ -34571,7 +34571,7 @@ "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format." }, "loyalty": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/EarningRuleFixed" }, @@ -34726,7 +34726,7 @@ } }, "EarningRuleProportionalOrder": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount" }, @@ -35209,7 +35209,7 @@ ] }, "EarningRuleProportional": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/EarningRuleProportionalOrder" }, @@ -35226,7 +35226,7 @@ "title": "Calculate points proportionally" }, "EarningRuleProportionalOrderItems": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity" }, @@ -36500,7 +36500,7 @@ ] }, "ExportsCreateRequestBody": { - "anyOf": [ + "oneOf": [ { "title": "Export Vouchers", "properties": { @@ -36798,7 +36798,7 @@ "$ref": "#/components/schemas/ExportBase" }, { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/ExportVoucher" }, @@ -36878,7 +36878,7 @@ ] }, { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/ExportVoucher" }, @@ -38158,12 +38158,12 @@ ] }, "Any": { - "anyOf": [ + "oneOf": [ { "title": "array", "type": "array", "items": { - "anyOf": [ + "oneOf": [ { "title": "string", "type": "string" @@ -38637,7 +38637,7 @@ }, "MappingPoints": { "title": "MappingPoints", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/MappingMultiply" }, @@ -39524,7 +39524,7 @@ }, "ProductCollectionsCreateRequestBody": { "title": "Create Product Collections Request Body", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/CreateStaticProductCollectionsRequestBody" }, @@ -39874,7 +39874,7 @@ }, "VouchersValidateResponseBody": { "title": "Vouchers Validate Response Body", - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/VouchersValidateValidResponseBody" }, @@ -46123,7 +46123,7 @@ "content": { "application/json": { "schema": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/e_400_invalid_voucher" }, @@ -51793,7 +51793,7 @@ "in": "query", "required": false, "schema": { - "anyOf": [ + "oneOf": [ { "type": "object", "title": "Customer details", @@ -51858,7 +51858,7 @@ "content": { "application/json": { "schema": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/6_res_validate_voucher" }, @@ -78250,7 +78250,7 @@ "content": { "application/json": { "schema": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/e_400_invalid_payload" }, @@ -79901,7 +79901,7 @@ "in": "query", "required": false, "schema": { - "anyOf": [ + "oneOf": [ { "$ref": "#/components/schemas/22_filter_updated_at" }, diff --git a/scripts/build-md-tables-from-openapi.ts b/scripts/build-md-tables-from-openapi.ts index 4adf003c2..7636c8999 100644 --- a/scripts/build-md-tables-from-openapi.ts +++ b/scripts/build-md-tables-from-openapi.ts @@ -4,8 +4,8 @@ import "./globals.t"; import * as openApi from "../reference/OpenAPI.json"; import { mdTables } from "./md-tables"; import SchemaToMarkdownTable, { - RenderMode, ExamplesRenderedAs, + RenderMode, } from "./src/schema-to-md-table"; const PATH_TO_GERENATED_TABLES = [__dirname, "./output"]; diff --git a/scripts/src/schema-to-md-table.ts b/scripts/src/schema-to-md-table.ts index c96b1ac2e..4b4b3198f 100644 --- a/scripts/src/schema-to-md-table.ts +++ b/scripts/src/schema-to-md-table.ts @@ -19,19 +19,13 @@ const nodeWithTitleAndPropertiesSchema = yup.object({ title: yup.string().optional(), type: yup.string().oneOf(["object", "string", "array", "number"]), properties: yup.object({}).optional(), - additionalProperties: yup.mixed().oneOfSchemas([yup.boolean(), yup.object({})]).optional(), - anyOf: yup.array().optional(), + additionalProperties: yup + .mixed() + .oneOfSchemas([yup.boolean(), yup.object({})]) + .optional(), + oneOf: yup.array().optional(), }); -const oneOfSchema = yup - .array() - .of( - yup.object({ - $ref: yup.string().required(), - }) - ) - .optional(); - const itemsSchema = yup .mixed() .oneOfSchemas([ @@ -40,7 +34,7 @@ const itemsSchema = yup ]) .optional(); -const anyOfSchema = yup +const oneOfSchema = yup .array() .of( yup @@ -52,12 +46,15 @@ const anyOfSchema = yup ) .optional(); -const allOfSchema = anyOfSchema; +const allOfSchema = oneOfSchema; const propertySchema = yup.object({ type: yup.mixed().oneOfSchemas([yup.string(), yup.array().of(yup.string())]), properties: yup.object({}).optional(), - additionalProperties: yup.mixed().oneOfSchemas([yup.boolean(), yup.object({})]).optional(), + additionalProperties: yup + .mixed() + .oneOfSchemas([yup.boolean(), yup.object({})]) + .optional(), description: yup.string().optional(), enum: yup .array() @@ -72,15 +69,14 @@ const propertySchema = yup.object({ ) .optional(), oneOf: oneOfSchema, - anyOf: anyOfSchema, allOf: allOfSchema, items: itemsSchema, $ref: yup.string().optional(), }); interface Items extends yup.InferType {} -interface AnyOf extends yup.InferType {} -interface AllOf extends yup.InferType {} +interface OneOf extends yup.InferType {} +interface AllOf extends yup.InferType {} interface OneOf extends yup.InferType {} export type Properties = Record; @@ -136,49 +132,17 @@ export default class SchemaToMarkdownTable { .replace(/[,]/g, "")})`; } - private renderOneOfDescription(oneOf: OneOf, level: number) { - const descriptionArr = []; - const relatedObjectsNames = []; - descriptionArr.push(`One of:`); - const nestedObjectsHtml = oneOf - .map((item) => { - const nestedObjectName = item["$ref"].replace( - "#/components/schemas/", - "" - ); - if (typeof this.schemas[nestedObjectName] !== "object") { - return false; - } - - relatedObjectsNames.push(nestedObjectName); - const title = (this.schemas[nestedObjectName].title || - nestedObjectName) as string; - if (this.redenderMode === RenderMode.List) { - return this.getMarkdownLinkToHeader(title); - } else { - const { html } = this.renderSchema(nestedObjectName, level + 1); - return renderMarkdown(html); - } - }) - .filter((i) => !!i); - descriptionArr.push( - nestedObjectsHtml.join(this.redenderMode === RenderMode.List ? ", " : "") - ); - - return { descriptionArr, relatedObjectsNames }; - } - - private renderAnyOfDescription( - anyOf: AnyOf, + private renderOneOfDescription( + oneOf: OneOf, level: number, - skipAnyOf: boolean = false + skipOneOf: boolean = false ) { const descriptionArr = []; const relatedObjectsNames = []; - if (!skipAnyOf) { - descriptionArr.push(`Any of:`); + if (!skipOneOf) { + descriptionArr.push(`One of:`); } - const nestedObjectsHtml = anyOf + const nestedObjectsHtml = oneOf .map((item) => { if ( "$ref" in item && @@ -270,7 +234,7 @@ export default class SchemaToMarkdownTable { .join(""); } - private renderAllOfDescription(allOf: AnyOf, level: number) { + private renderAllOfDescription(allOf: OneOf, level: number) { const descriptionArr = []; const relatedObjectsNames = []; descriptionArr.push(`All of:`); @@ -301,14 +265,14 @@ export default class SchemaToMarkdownTable { const { html, relatedObjects } = this.renderSchema(item, level + 1); relatedObjectsNames.push(...relatedObjects); return renderMarkdown(html); - } else if ("anyOf" in item) { - const anyOf = anyOfSchema.validateSync(item["anyOf"]); + } else if ("oneOf" in item) { + const oneOf = oneOfSchema.validateSync(item["oneOf"]); const { - descriptionArr: anyOfDescriptionArr, - relatedObjectsNames: anyOfRelatedObjectsNames, - } = this.renderAnyOfDescription(anyOf, level + 1); - relatedObjectsNames.push(...anyOfRelatedObjectsNames); - return anyOfDescriptionArr.join(" "); + descriptionArr: oneOfDescriptionArr, + relatedObjectsNames: oneOfRelatedObjectsNames, + } = this.renderOneOfDescription(oneOf, level + 1); + relatedObjectsNames.push(...oneOfRelatedObjectsNames); + return oneOfDescriptionArr.join(" "); } }) .filter((i) => !!i); @@ -348,14 +312,14 @@ export default class SchemaToMarkdownTable { const { html, relatedObjects } = this.renderSchema(items, level + 1); relatedObjectsNames.push(...relatedObjects); descriptionArr.push(renderMarkdown(html)); - } else if ("anyOf" in items) { - const anyOf = anyOfSchema.validateSync(items.anyOf); + } else if ("oneOf" in items) { + const oneOf = oneOfSchema.validateSync(items.oneOf); const { - descriptionArr: anyOfDescriptionArr, - relatedObjectsNames: anyOfRelatedObjectsNames, - } = this.renderAnyOfDescription(anyOf, level + 1, true); - relatedObjectsNames.push(...anyOfRelatedObjectsNames); - descriptionArr.push(`Array any of: ${anyOfDescriptionArr.join(" ")}`); + descriptionArr: oneOfDescriptionArr, + relatedObjectsNames: oneOfRelatedObjectsNames, + } = this.renderOneOfDescription(oneOf, level + 1, true); + relatedObjectsNames.push(...oneOfRelatedObjectsNames); + descriptionArr.push(`Array any of: ${oneOfDescriptionArr.join(" ")}`); } return { descriptionArr, relatedObjectsNames }; } @@ -367,7 +331,9 @@ export default class SchemaToMarkdownTable { const nestedObjectName = ref.replace("#/components/schemas/", ""); relatedObjectsNames.push(nestedObjectName); const title = (this.schemas[nestedObjectName].title || - nestedObjectName.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z])([A-Z])/g, '$1 $2')) as string; + nestedObjectName + .replace(/([a-z])([A-Z])/g, "$1 $2") + .replace(/([A-Z])([A-Z])/g, "$1 $2")) as string; if (this.redenderMode === RenderMode.List) { descriptionArr.push(`See: ${this.getMarkdownLinkToHeader(title)}`); } else { @@ -388,13 +354,12 @@ export default class SchemaToMarkdownTable { description, enum: EnumProp, oneOf, - anyOf, allOf, items, type, $ref, properties, - additionalProperties, + additionalProperties, } = propertySchema.validateSync(property); if (description) { @@ -408,15 +373,6 @@ export default class SchemaToMarkdownTable { descriptionArr.push(availableValues); } - if (oneOf) { - const { - descriptionArr: descriptionArrOneOf, - relatedObjectsNames: relatedObjectsNamesOneOff, - } = this.renderOneOfDescription(oneOf, level); - descriptionArr.push(...descriptionArrOneOf); - relatedObjectsNames.push(...relatedObjectsNamesOneOff); - } - if (allOf) { const { descriptionArr: descriptionArrAllOf, @@ -426,13 +382,13 @@ export default class SchemaToMarkdownTable { relatedObjectsNames.push(...relatedObjectsNamesAllOff); } - if (anyOf) { + if (oneOf) { const { - descriptionArr: descriptionArrAnyOf, - relatedObjectsNames: relatedObjectsNamesAnyOff, - } = this.renderAnyOfDescription(anyOf, level); - descriptionArr.push(...descriptionArrAnyOf); - relatedObjectsNames.push(...relatedObjectsNamesAnyOff); + descriptionArr: descriptionArrOneOf, + relatedObjectsNames: relatedObjectsNamesOneOff, + } = this.renderOneOfDescription(oneOf, level); + descriptionArr.push(...descriptionArrOneOf); + relatedObjectsNames.push(...relatedObjectsNamesOneOff); } if (items) { @@ -453,7 +409,10 @@ export default class SchemaToMarkdownTable { relatedObjectsNames.push(...relatedObjectsNamesItems); } - if (type === "object" && (properties instanceof Object || additionalProperties instanceof Object)) { + if ( + type === "object" && + (properties instanceof Object || additionalProperties instanceof Object) + ) { const { html, relatedObjects } = this.renderSchema(property, level + 1); relatedObjectsNames.push(...relatedObjects); descriptionArr.push(renderMarkdown(html)); @@ -523,11 +482,16 @@ export default class SchemaToMarkdownTable { throw new Error(`Schema "${schema}" not found`); } - const schemaResult = nodeWithTitleAndPropertiesSchema.validateSync(schema) - const { title, additionalProperties } = schemaResult - const properties = schemaResult.properties instanceof Object ? schemaResult.properties : additionalProperties instanceof Object ? {} : undefined - if(additionalProperties instanceof Object){ - properties['[propertyName]'] = additionalProperties + const schemaResult = nodeWithTitleAndPropertiesSchema.validateSync(schema); + const { title, additionalProperties } = schemaResult; + const properties = + schemaResult.properties instanceof Object + ? schemaResult.properties + : additionalProperties instanceof Object + ? {} + : undefined; + if (additionalProperties instanceof Object) { + properties["[propertyName]"] = additionalProperties; } const respopnseStrArr = [];