-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API]Add inStock serialization to productVariant #12639
Conversation
arti0090
commented
May 17, 2021
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
License | MIT |
@@ -17,20 +18,25 @@ final class ProductVariantSerializer implements ContextAwareNormalizerInterface | |||
/** @var NormalizerInterface */ | |||
private $objectNormalizer; | |||
|
|||
/** @var ProductVariantPriceCalculatorInterface */ | |||
/** @var ProductVariantPricesCalculatorInterface */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this Interface, as It shows as deprecated.
cf1c17b
to
7a905e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should implement this scenario in API context
src/Sylius/Bundle/ApiBundle/Serializer/ProductVariantSerializer.php
Outdated
Show resolved
Hide resolved
src/Sylius/Behat/Resources/config/suites/api/inventory/cart_inventory.yml
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Resources/translations/validators.en.yaml
Outdated
Show resolved
Hide resolved
2c636cd
to
4571e19
Compare
$this->putProductVariantToCart($productVariant, $tokenValue); | ||
|
||
$response = $this->cartsClient->getLastResponse(); | ||
Assert::same($response->getStatusCode(), 422); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check here validation message instead status code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to explain myself why I check status Code; the step is about 'unable to add it to the cart' and I dont think that this step cares why it happens (what validation message). This I think should be checked somewhere else, in add to cart validation behats 😃
Thanks, @arti0090! 🥇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This additional field should be probably added to the Swagger docs
@@ -45,15 +51,17 @@ public function normalize($object, $format = null, array $context = []) | |||
unset($data['price']); | |||
} | |||
|
|||
$data['inStock'] = $this->availabilityChecker->isStockAvailable($object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it also shown in api reference in swagger?
This PR was merged into the 1.10-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master | Bug fix? | no | New feature? | yes (missed thing) | BC breaks? | no | Deprecations? | no | Related tickets | Extends #12639 | License | MIT I forgot to add this to PR, forgive me sylius 🙏 Commits ------- de3a88d [API] Add missing inStock field to swagger 6798ade Changed to proper resource ProductVariant and fixed price