Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit b6d2bf1

Browse files
authored
Merge pull request #705 from commercetools/required_fields
2 parents d87a923 + 759cdc3 commit b6d2bf1

File tree

154 files changed

+845
-695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+845
-695
lines changed

src/Core/Model/ApiClient/ApiClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ public function fieldDefinitions()
3737
'scope' => [static::TYPE => 'string'],
3838
'createdAt' => [
3939
static::TYPE => DateTime::class,
40+
static::OPTIONAL => true,
4041
static::DECORATOR => DateTimeDecorator::class
4142
],
4243
'lastUsedAt' => [
4344
static::TYPE => DateTime::class,
45+
static::OPTIONAL => true,
4446
static::DECORATOR => DateDecorator::class
4547
],
46-
'secret' => [static::TYPE => 'string'],
48+
'secret' => [static::TYPE => 'string', static::OPTIONAL => true],
4749
'deleteAt' => [
4850
static::TYPE => DateTime::class,
51+
static::OPTIONAL => true,
4952
static::DECORATOR => DateTimeDecorator::class
5053
],
5154
];

src/Core/Model/ApiClient/ApiClientDraft.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function fieldDefinitions()
2424
return [
2525
'name' => [static::TYPE => 'string'],
2626
'scope' => [static::TYPE => 'string'],
27-
'deleteDaysAfterCreation' => [static::TYPE => 'int'],
27+
'deleteDaysAfterCreation' => [static::TYPE => 'int', self::OPTIONAL => true],
2828
];
2929
}
3030

src/Core/Model/Cart/Cart.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function fieldDefinitions()
115115
{
116116
return [
117117
'id' => [static::TYPE => 'string'],
118-
'key' => [static::TYPE => 'string'],
118+
'key' => [static::TYPE => 'string', static::OPTIONAL => true],
119119
'version' => [static::TYPE => 'int'],
120120
'createdAt' => [
121121
static::TYPE => DateTime::class,
@@ -125,35 +125,35 @@ public function fieldDefinitions()
125125
static::TYPE => DateTime::class,
126126
static::DECORATOR => DateTimeDecorator::class
127127
],
128-
'customerId' => [static::TYPE => 'string'],
129-
'customerEmail' => [static::TYPE => 'string'],
128+
'customerId' => [static::TYPE => 'string', static::OPTIONAL => true],
129+
'customerEmail' => [static::TYPE => 'string', static::OPTIONAL => true],
130130
'lineItems' => [static::TYPE => LineItemCollection::class],
131131
'customLineItems' => [static::TYPE => CustomLineItemCollection::class],
132132
'totalPrice' => [static::TYPE => Money::class],
133-
'taxedPrice' => [static::TYPE => TaxedPrice::class],
133+
'taxedPrice' => [static::TYPE => TaxedPrice::class, static::OPTIONAL => true],
134134
'cartState' => [static::TYPE => 'string'],
135-
'shippingAddress' => [static::TYPE => Address::class],
136-
'billingAddress' => [static::TYPE => Address::class],
137-
'inventoryMode' => [static::TYPE => 'string'],
138-
'customerGroup' => [static::TYPE => CustomerGroupReference::class],
139-
'country' => [static::TYPE => 'string'],
140-
'shippingInfo' => [static::TYPE => ShippingInfo::class],
141-
'discountCodes' => [static::TYPE => DiscountCodeInfoCollection::class],
142-
'custom' => [static::TYPE => CustomFieldObject::class],
143-
'paymentInfo' => [static::TYPE => PaymentInfo::class],
135+
'shippingAddress' => [static::TYPE => Address::class, static::OPTIONAL => true],
136+
'billingAddress' => [static::TYPE => Address::class, static::OPTIONAL => true],
137+
'inventoryMode' => [static::TYPE => 'string', static::OPTIONAL => true],
138+
'customerGroup' => [static::TYPE => CustomerGroupReference::class, static::OPTIONAL => true],
139+
'country' => [static::TYPE => 'string', static::OPTIONAL => true],
140+
'shippingInfo' => [static::TYPE => ShippingInfo::class, static::OPTIONAL => true],
141+
'discountCodes' => [static::TYPE => DiscountCodeInfoCollection::class, static::OPTIONAL => true],
142+
'custom' => [static::TYPE => CustomFieldObject::class, static::OPTIONAL => true],
143+
'paymentInfo' => [static::TYPE => PaymentInfo::class, static::OPTIONAL => true],
144144
'taxMode' => [static::TYPE => 'string'],
145-
'anonymousId' => [static::TYPE => 'string'],
146-
'locale' => [static::TYPE => 'string'],
145+
'anonymousId' => [static::TYPE => 'string', static::OPTIONAL => true],
146+
'locale' => [static::TYPE => 'string', static::OPTIONAL => true],
147147
'taxRoundingMode' => [static::TYPE => 'string'],
148-
'deleteDaysAfterLastModification' => [static::TYPE => 'int'],
148+
'deleteDaysAfterLastModification' => [static::TYPE => 'int', static::OPTIONAL => true],
149149
'refusedGifts' => [static::TYPE => CartDiscountReferenceCollection::class],
150150
'origin' => [static::TYPE => 'string'],
151151
'taxCalculationMode' => [static::TYPE => 'string'],
152-
'shippingRateInput' => [static::TYPE => ShippingRateInput::class],
153-
'itemShippingAddresses' => [static::TYPE => AddressCollection::class],
154-
'store' => [static::TYPE => StoreReference::class],
155-
'createdBy' => [static::TYPE => CreatedBy::class],
156-
'lastModifiedBy' => [static::TYPE => LastModifiedBy::class],
152+
'shippingRateInput' => [static::TYPE => ShippingRateInput::class, static::OPTIONAL => true],
153+
'itemShippingAddresses' => [static::TYPE => AddressCollection::class, static::OPTIONAL => true],
154+
'store' => [static::TYPE => StoreReference::class, static::OPTIONAL => true],
155+
'createdBy' => [static::TYPE => CreatedBy::class, static::OPTIONAL => true],
156+
'lastModifiedBy' => [static::TYPE => LastModifiedBy::class, static::OPTIONAL => true],
157157
];
158158
}
159159

src/Core/Model/Cart/CartDraft.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,30 +77,30 @@ public function fieldDefinitions()
7777
{
7878
return [
7979
'currency' => [static::TYPE => 'string'],
80-
'key' => [static::TYPE => 'string'],
81-
'customerId' => [static::TYPE => 'string'],
82-
'customerEmail' => [static::TYPE => 'string'],
83-
'country' => [static::TYPE => 'string'],
84-
'inventoryMode' => [static::TYPE => 'string'],
85-
'lineItems' => [static::TYPE => LineItemDraftCollection::class],
86-
'customLineItems' => [static::TYPE => CustomLineItemDraftCollection::class],
87-
'shippingAddress' => [static::TYPE => Address::class],
88-
'billingAddress' => [static::TYPE => Address::class],
89-
'shippingMethod' => [static::TYPE => ShippingMethodReference::class],
90-
'custom' => [static::TYPE => CustomFieldObjectDraft::class],
91-
'taxMode' => [static::TYPE => 'string'],
92-
'anonymousId' => [static::TYPE => 'string'],
93-
'locale' => [static::TYPE => 'string'],
94-
'taxRoundingMode' => [static::TYPE => 'string'],
95-
'deleteDaysAfterLastModification' => [static::TYPE => 'int'],
96-
'customerGroup' => [static::TYPE => CustomerGroupReference::class],
97-
'origin' => [static::TYPE => 'string'],
98-
'taxCalculationMode' => [static::TYPE => 'string'],
99-
'externalTaxRateForShippingMethod' => [static::TYPE => ExternalTaxRateDraft::class],
100-
'shippingRateInput' => [static::TYPE => ShippingRateInputDraft::class],
101-
'itemShippingAddresses' => [static::TYPE => AddressCollection::class],
102-
'store' => [static::TYPE => StoreReference::class],
103-
'discountCodes' => [static::TYPE => 'array'],
80+
'key' => [static::TYPE => 'string', static::OPTIONAL => true],
81+
'customerId' => [static::TYPE => 'string', static::OPTIONAL => true],
82+
'customerEmail' => [static::TYPE => 'string', static::OPTIONAL => true],
83+
'country' => [static::TYPE => 'string', static::OPTIONAL => true],
84+
'inventoryMode' => [static::TYPE => 'string', static::OPTIONAL => true],
85+
'lineItems' => [static::TYPE => LineItemDraftCollection::class, static::OPTIONAL => true],
86+
'customLineItems' => [static::TYPE => CustomLineItemDraftCollection::class, static::OPTIONAL => true],
87+
'shippingAddress' => [static::TYPE => Address::class, static::OPTIONAL => true],
88+
'billingAddress' => [static::TYPE => Address::class, static::OPTIONAL => true],
89+
'shippingMethod' => [static::TYPE => ShippingMethodReference::class, static::OPTIONAL => true],
90+
'custom' => [static::TYPE => CustomFieldObjectDraft::class, static::OPTIONAL => true],
91+
'taxMode' => [static::TYPE => 'string', static::OPTIONAL => true],
92+
'anonymousId' => [static::TYPE => 'string', static::OPTIONAL => true],
93+
'locale' => [static::TYPE => 'string', static::OPTIONAL => true],
94+
'taxRoundingMode' => [static::TYPE => 'string', static::OPTIONAL => true],
95+
'deleteDaysAfterLastModification' => [static::TYPE => 'int', static::OPTIONAL => true],
96+
'customerGroup' => [static::TYPE => CustomerGroupReference::class, static::OPTIONAL => true],
97+
'origin' => [static::TYPE => 'string', static::OPTIONAL => true],
98+
'taxCalculationMode' => [static::TYPE => 'string', static::OPTIONAL => true],
99+
'externalTaxRateForShippingMethod' => [static::TYPE => ExternalTaxRateDraft::class, static::OPTIONAL => true],
100+
'shippingRateInput' => [static::TYPE => ShippingRateInputDraft::class, static::OPTIONAL => true],
101+
'itemShippingAddresses' => [static::TYPE => AddressCollection::class, static::OPTIONAL => true],
102+
'store' => [static::TYPE => StoreReference::class, static::OPTIONAL => true],
103+
'discountCodes' => [static::TYPE => 'array', static::OPTIONAL => true],
104104
];
105105
}
106106

src/Core/Model/Cart/CustomLineItem.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ public function fieldDefinitions()
5151
'id' => [static::TYPE => 'string'],
5252
'name' => [static::TYPE => LocalizedString::class],
5353
'money' => [static::TYPE => Money::class],
54-
'taxedPrice' => [static::TYPE => TaxedItemPrice::class],
54+
'taxedPrice' => [static::TYPE => TaxedItemPrice::class, static::OPTIONAL => true],
5555
'slug' => [static::TYPE => 'string'],
5656
'quantity' => [static::TYPE => 'int'],
5757
'state' => [static::TYPE => ItemState::class],
58-
'taxCategory' => [static::TYPE => TaxCategoryReference::class],
59-
'taxRate' => [static::TYPE => TaxRate::class],
60-
'custom' => [static::TYPE => CustomFieldObject::class],
58+
'taxCategory' => [static::TYPE => TaxCategoryReference::class, static::OPTIONAL => true],
59+
'taxRate' => [static::TYPE => TaxRate::class, static::OPTIONAL => true],
60+
'custom' => [static::TYPE => CustomFieldObject::class, static::OPTIONAL => true],
6161
'totalPrice' => [static::TYPE => Money::class],
6262
'discountedPricePerQuantity' => [
6363
static::TYPE => DiscountedPricePerQuantityCollection::class
6464
],
65-
'shippingDetails' => [static::TYPE => ItemShippingDetails::class],
65+
'shippingDetails' => [static::TYPE => ItemShippingDetails::class, static::OPTIONAL => true],
6666
];
6767
}
6868

src/Core/Model/Cart/CustomLineItemDraft.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public function fieldDefinitions()
4848
'money' => [static::TYPE => Money::class],
4949
'slug' => [static::TYPE => 'string'],
5050
'quantity' => [static::TYPE => 'int'],
51-
'taxCategory' => [static::TYPE => TaxCategoryReference::class],
52-
'externalTaxRate' => [static::TYPE => ExternalTaxRateDraft::class],
53-
'custom' => [static::TYPE => CustomFieldObject::class],
54-
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class],
51+
'taxCategory' => [static::TYPE => TaxCategoryReference::class, static::OPTIONAL => true],
52+
'externalTaxRate' => [static::TYPE => ExternalTaxRateDraft::class, static::OPTIONAL => true],
53+
'custom' => [static::TYPE => CustomFieldObject::class, static::OPTIONAL => true],
54+
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class, static::OPTIONAL => true],
5555
];
5656
}
5757

src/Core/Model/Cart/LineItem.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,28 @@ public function fieldDefinitions()
7979
return [
8080
'id' => [static::TYPE => 'string'],
8181
'productId' => [static::TYPE => 'string'],
82-
'productKey' => [static::TYPE => 'string'],
82+
'productKey' => [static::TYPE => 'string', static::OPTIONAL => true],
8383
'name' => [static::TYPE => LocalizedString::class],
84-
'productSlug' => [static::TYPE => LocalizedString::class],
84+
'productSlug' => [static::TYPE => LocalizedString::class, static::OPTIONAL => true],
8585
'variant' => [static::TYPE => ProductVariant::class],
8686
'price' => [static::TYPE => Price::class],
87-
'taxedPrice' => [static::TYPE => TaxedItemPrice::class],
87+
'taxedPrice' => [static::TYPE => TaxedItemPrice::class, static::OPTIONAL => true],
8888
'quantity' => [static::TYPE => 'int'],
89-
'addedAt' => [static::TYPE => DateTime::class],
89+
'addedAt' => [static::TYPE => DateTime::class, static::OPTIONAL => true],
9090
'state' => [static::TYPE => ItemStateCollection::class],
91-
'taxRate' => [static::TYPE => TaxRate::class],
92-
'supplyChannel' => [static::TYPE => ChannelReference::class],
93-
'distributionChannel' => [static::TYPE => ChannelReference::class],
94-
'custom' => [static::TYPE => CustomFieldObject::class],
91+
'taxRate' => [static::TYPE => TaxRate::class, static::OPTIONAL => true],
92+
'supplyChannel' => [static::TYPE => ChannelReference::class, static::OPTIONAL => true],
93+
'distributionChannel' => [static::TYPE => ChannelReference::class, static::OPTIONAL => true],
94+
'custom' => [static::TYPE => CustomFieldObject::class, static::OPTIONAL => true],
9595
'totalPrice' => [static::TYPE => Money::class],
9696
'discountedPricePerQuantity' => [
9797
static::TYPE => DiscountedPricePerQuantityCollection::class
9898
],
9999
'priceMode' => [static::TYPE => 'string'],
100100
'lineItemMode' => [static::TYPE => 'string'],
101101
'productType' => [static::TYPE => ProductTypeReference::class],
102-
'shippingDetails' => [static::TYPE => ItemShippingDetails::class],
103-
'lastModifiedAt' => [static::TYPE => DateTime::class],
102+
'shippingDetails' => [static::TYPE => ItemShippingDetails::class, static::OPTIONAL => true],
103+
'lastModifiedAt' => [static::TYPE => DateTime::class, static::OPTIONAL => true],
104104
];
105105
}
106106

src/Core/Model/Cart/LineItemDraft.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ class LineItemDraft extends JsonObject
4646
public function fieldDefinitions()
4747
{
4848
return [
49-
'productId' => [static::TYPE => 'string'],
50-
'variantId' => [static::TYPE => 'int'],
51-
'quantity' => [static::TYPE => 'int'],
52-
'supplyChannel' => [static::TYPE => ChannelReference::class],
53-
'distributionChannel' => [static::TYPE => ChannelReference::class],
54-
'externalTaxRate' => [static::TYPE => ExternalTaxRateDraft::class],
55-
'externalPrice' => [static::TYPE => Money::class],
56-
'externalTotalPrice' => [static::TYPE => ExternalLineItemTotalPrice::class],
57-
'custom' => [static::TYPE => CustomFieldObject::class],
58-
'sku' => [static::TYPE => 'string'],
59-
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class],
60-
'addedAt' => [static::TYPE => DateTime::class],
49+
'productId' => [static::TYPE => 'string', static::OPTIONAL => true],
50+
'variantId' => [static::TYPE => 'int', static::OPTIONAL => true],
51+
'quantity' => [static::TYPE => 'int', static::OPTIONAL => true],
52+
'supplyChannel' => [static::TYPE => ChannelReference::class, static::OPTIONAL => true],
53+
'distributionChannel' => [static::TYPE => ChannelReference::class, static::OPTIONAL => true],
54+
'externalTaxRate' => [static::TYPE => ExternalTaxRateDraft::class, static::OPTIONAL => true],
55+
'externalPrice' => [static::TYPE => Money::class, static::OPTIONAL => true],
56+
'externalTotalPrice' => [static::TYPE => ExternalLineItemTotalPrice::class, static::OPTIONAL => true],
57+
'custom' => [static::TYPE => CustomFieldObject::class, static::OPTIONAL => true],
58+
'sku' => [static::TYPE => 'string', static::OPTIONAL => true],
59+
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class, static::OPTIONAL => true],
60+
'addedAt' => [static::TYPE => DateTime::class, static::OPTIONAL => true],
6161
];
6262
}
6363

src/Core/Model/Cart/MyCartDraft.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ public function fieldDefinitions()
5050
{
5151
return [
5252
'currency' => [static::TYPE => 'string'],
53-
'customerEmail' => [static::TYPE => 'string'],
54-
'country' => [static::TYPE => 'string'],
55-
'inventoryMode' => [static::TYPE => 'string'],
56-
'lineItems' => [static::TYPE => MyLineItemDraftCollection::class],
57-
'shippingAddress' => [static::TYPE => Address::class],
58-
'billingAddress' => [static::TYPE => Address::class],
59-
'shippingMethod' => [static::TYPE => ShippingMethodReference::class],
60-
'custom' => [static::TYPE => CustomFieldObjectDraft::class],
61-
'locale' => [static::TYPE => 'string'],
62-
'deleteDaysAfterLastModification' => [static::TYPE => 'int'],
63-
'taxMode' => [static::TYPE => 'string'],
64-
'itemShippingAddresses' => [static::TYPE => AddressCollection::class],
53+
'customerEmail' => [static::TYPE => 'string', static::OPTIONAL => true],
54+
'country' => [static::TYPE => 'string', static::OPTIONAL => true],
55+
'inventoryMode' => [static::TYPE => 'string', static::OPTIONAL => true],
56+
'lineItems' => [static::TYPE => MyLineItemDraftCollection::class, static::OPTIONAL => true],
57+
'shippingAddress' => [static::TYPE => Address::class, static::OPTIONAL => true],
58+
'billingAddress' => [static::TYPE => Address::class, static::OPTIONAL => true],
59+
'shippingMethod' => [static::TYPE => ShippingMethodReference::class, static::OPTIONAL => true],
60+
'custom' => [static::TYPE => CustomFieldObjectDraft::class, static::OPTIONAL => true],
61+
'locale' => [static::TYPE => 'string', static::OPTIONAL => true],
62+
'deleteDaysAfterLastModification' => [static::TYPE => 'int', static::OPTIONAL => true],
63+
'taxMode' => [static::TYPE => 'string', static::OPTIONAL => true],
64+
'itemShippingAddresses' => [static::TYPE => AddressCollection::class, static::OPTIONAL => true],
6565
];
6666
}
6767

src/Core/Model/Cart/MyLineItemDraft.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ class MyLineItemDraft extends JsonObject
3838
public function fieldDefinitions()
3939
{
4040
return [
41-
'productId' => [static::TYPE => 'string'],
42-
'variantId' => [static::TYPE => 'int'],
41+
'productId' => [static::TYPE => 'string', static::OPTIONAL => true],
42+
'variantId' => [static::TYPE => 'int', static::OPTIONAL => true],
4343
'quantity' => [static::TYPE => 'int'],
44-
'supplyChannel' => [static::TYPE => ChannelReference::class],
45-
'distributionChannel' => [static::TYPE => ChannelReference::class],
46-
'custom' => [static::TYPE => CustomFieldObject::class],
47-
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class],
48-
'sku' => [static::TYPE => 'string'],
49-
'addedAt' => [static::TYPE => DateTime::class],
44+
'supplyChannel' => [static::TYPE => ChannelReference::class, static::OPTIONAL => true],
45+
'distributionChannel' => [static::TYPE => ChannelReference::class, static::OPTIONAL => true],
46+
'custom' => [static::TYPE => CustomFieldObject::class, static::OPTIONAL => true],
47+
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class, static::OPTIONAL => true],
48+
'sku' => [static::TYPE => 'string', static::OPTIONAL => true],
49+
'addedAt' => [static::TYPE => DateTime::class, static::OPTIONAL => true],
5050
];
5151
}
5252

0 commit comments

Comments
 (0)