Skip to content

Commit

Permalink
Changed to proper resource ProductVariant and fixed price
Browse files Browse the repository at this point in the history
  • Loading branch information
arti0090 committed May 20, 2021
1 parent de3a88d commit 6798ade
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,8 @@ public function normalize($object, $format = null, array $context = [])
'readOnly' => true,
];

$inStockSchema = [
'type' => 'boolean',
'nullable' => false,
'readOnly' => true,
];

$docs['components']['schemas']['Product.jsonld-admin.product.read']['properties']['defaultVariant'] = $defaultVariantSchema;
$docs['components']['schemas']['Product.jsonld-shop.product.read']['properties']['defaultVariant'] = $defaultVariantSchema;
$docs['components']['schemas']['Product.jsonld-shop.product.read']['properties']['inStock'] = $inStockSchema;

return $docs;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ public function normalize($object, $format = null, array $context = [])
{
$docs = $this->decoratedNormalizer->normalize($object, $format, $context);

$docs['components']['schemas']['ProductVariant:jsonld-product_variant:read']['properties']['price'] = [
$docs['components']['schemas']['ProductVariant.jsonld-shop.product_variant.read']['properties']['price'] = [
'type' => 'int',
'readOnly' => true,
'default' => 0,
];

$docs['components']['schemas']['ProductVariant.jsonld-shop.product_variant.read']['properties']['inStock'] = [
'type' => 'boolean',
'readOnly' => true,
];

return $docs;
}
}

0 comments on commit 6798ade

Please sign in to comment.