Skip to content
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

Merged
merged 2 commits into from May 17, 2021

Conversation

arti0090
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
License MIT

@arti0090 arti0090 requested a review from a team as a code owner May 17, 2021 06:56
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label May 17, 2021
@@ -17,20 +18,25 @@ final class ProductVariantSerializer implements ContextAwareNormalizerInterface
/** @var NormalizerInterface */
private $objectNormalizer;

/** @var ProductVariantPriceCalculatorInterface */
/** @var ProductVariantPricesCalculatorInterface */
Copy link
Contributor Author

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.

Copy link
Member

@GSadee GSadee left a 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

$this->putProductVariantToCart($productVariant, $tokenValue);

$response = $this->cartsClient->getLastResponse();
Assert::same($response->getStatusCode(), 422);
Copy link
Contributor

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?

Copy link
Contributor Author

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 😃

@GSadee GSadee merged commit 2318f31 into Sylius:master May 17, 2021
@GSadee
Copy link
Member

GSadee commented May 17, 2021

Thanks, @arti0090! 🥇

Copy link
Member

@GSadee GSadee left a 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);
Copy link
Member

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?

GSadee added a commit that referenced this pull request May 24, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants