Uploaded image for project: 'PUBLIC - Liferay Commerce'
  1. PUBLIC - Liferay Commerce
  2. COMMERCE-5308

Product API allows you to create products with invalid specificiations

    Details

    • Severity of Issue:
      Major

      Description

      When creating a new product through the API, it's possible to successfully create a product that contains invalid product specifications.  The resultant product can be viewed through the Product API but not through the UI.  

      Steps to Reproduce

      1.  Submit a POST request to the following end point with 

      http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/products/ 

      with the following JSON body (update catalogId to match local environment):

      {
          "active": true,
          "catalogId": 48830,
          "description": {
              "en_US": ""
          },
          "externalReferenceCode": "DEMO",
          "name": {
              "en_US": "Demo Product"
          },
          "productStatus": 0,
          "productType": "simple",
          "shortDescription": {
              "en_US": ""
          },
          "skuFormatted": "DEMO",
      	"productSpecifications": [
      		{
      			"optionCategoryId": 0,
      			"priority": 0.0,
      			"specificationKey": "demo-spec*",
      			"value": {
      				"en_US": "Demo Spec*"
      			}
      		}			
      	]
      }
      

       

      Expected Result

      Request returns appropriate response code (400?) and a warning that the product specification syntax or values are incorrect.  

      Actual Result

      Request returns 200, but the product is not visible in the UI.  You can query the product using the API and it returns successfully, however if you try to visit http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/products/<productId>/productSpecifications you'll get a message that says:  

      {
        "status": "NOT_FOUND",
        "title": "No CPSpecificationOption exists with the primary key 0"
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              andrea.sbarra Andrea Sbarra
              Reporter:
              jeffrey.handa Jeffrey P. Handa
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Packages

                  Version Package
                  7.4 CE GA1