FIWARE-TMForum / Business-API-Ecosystem

The FIWARE/TMForum Business API Ecosystem allows the monetization of different kind of assets (both digital and physical) during the whole service life cycle, from offering creation to its charging, accounting and revenue settlement and sharing
https://business-api-ecosystem.rtfd.io/
GNU Affero General Public License v3.0
39 stars 22 forks source link

Internal server error in productSpecification #70

Open johnnychoque opened 2 months ago

johnnychoque commented 2 months ago

Hi all,

In BAE v8 I used the bae-ngsi-query plugin without problems. Now when using it in BAE v8.1 it generates an error when trying to create a product.

I have simplified the plugin code so that the package.json now only has the following information:

{
    "name": "EDC-plugin",
    "author": "jchoque",
    "version": "0.1",
    "module": "ngsi_query.NGSIQuery",
    "media_types": ["application/json"],
    "formats": ["URL"],
    "overrides": [],
    "pull_accounting": true,
    "form_order": ["app_id", "role"],
    "form": {
        "app_id": {
            "type": "text",
            "label": "Application ID",
            "placeholder": "app_id",
            "mandatory": true
        },
        "role": {
            "type": "text",
            "label": "Acquisition Role",
            "placeholder": "customer",
            "mandatory": true
        }
    }
}

The data entered for the new product is as follows: Screenshot from 2024-09-24 12-47-36

But when trying to create the product the error is displayed: ‘The server has failed validating the product specification’

Using the API http://localhost:8004/DSProductCatalog/api/catalogManagement/v2/productSpecification with the same body that is used through the GUI:

{
   "version":"0.1",
   "lifecycleStatus":"Active",
   "isBundle":false,
   "bundledProductSpecification":[

   ],
   "productSpecCharacteristic":[
      {
         "name":"Asset type",
         "description":"Type of the digital asset described in this product specification",
         "valueType":"string",
         "configurable":false,
         "productSpecCharacteristicValue":[
            {
               "default":true,
               "unitOfMeasure":"",
               "value":"EDC-plugin",
               "valueFrom":"",
               "valueTo":""
            }
         ]
      },
      {
         "name":"Media type",
         "description":"Media type of the digital asset described in this product specification",
         "valueType":"string",
         "configurable":false,
         "productSpecCharacteristicValue":[
            {
               "default":true,
               "unitOfMeasure":"",
               "value":"application/json",
               "valueFrom":"",
               "valueTo":""
            }
         ]
      },
      {
         "name":"Location",
         "description":"URL pointing to the digital asset described in this product specification",
         "valueType":"string",
         "configurable":false,
         "productSpecCharacteristicValue":[
            {
               "default":true,
               "unitOfMeasure":"",
               "value":"http://localhost:7788",
               "valueFrom":"",
               "valueTo":""
            }
         ]
      },
      {
         "name":"Asset",
         "description":"ID of the asset being offered as registered in the BAE",
         "valueType":"string",
         "configurable":false,
         "productSpecCharacteristicValue":[
            {
               "default":true,
               "unitOfMeasure":"",
               "value":"66f28831564898e78b85c45e",
               "valueFrom":"",
               "valueTo":""
            }
         ]
      }
   ],
   "productSpecificationRelationship":[

   ],
   "attachment":[
      {
         "type":"Picture"
      }
   ],
   "relatedParty":[
      {
         "id":"ac0234e4-1e03-493f-b26f-ea5cda3fcd9d",
         "href":"http://bae.docker:8004/DSPartyManagement/api/partyManagement/v2/individual/ac0234e4-1e03-493f-b26f-ea5cda3fcd9d",
         "role":"Owner"
      }
   ],
   "name":"Prod pruebas",
   "brand":"Pruebas"
}

You get the following response:

{
  error": “ProductError: Automatic creation of digital assets with expected metadata is not supported” 
}

The API POST: /DSProductCatalog/api/catalogManagement/v2/productSpecification response with status 500

Screenshot from 2024-09-24 12-58-46

Could you give me any idea why this error occurs and how to fix it?