cap-js / ord

Open Resource Discovery (ORD) is a protocol that allows applications and services to self-describe their exposed resources and capabilities. This plugin enables generation of ORD document for CAP based applications.
Apache License 2.0
3 stars 4 forks source link

Ord generated document contains undefined in different ids #40

Closed zongqichen closed 1 month ago

zongqichen commented 3 months ago

The ord plugin version is 1.0.3. The following example is ord plugin generated, you can find the full document

  "apiResources": [
    {
      "ordId": "sap.sm:apiResource:undefined.SupplierService:v1",
...
      "partOfGroups": [
        "sap.cds:service:sap.sm:undefined.SupplierService"
      ],
...
    {
      "ordId": "sap.sm:apiResource:undefined.MaterialService:v1",
 ...
    {
      "ordId": "sap.sm:apiResource:undefined.PurchaseOrderService:v1",
...
      "partOfGroups": [
        "sap.cds:service:sap.sm:undefined.PurchaseOrderService"
      ],

I would expect, for example, the full original document

  "apiResources": [
    {
      "ordId": "sap.s4:apiResource:SupplierService:v1",

If it is a bug, I can fix it.

zongqichen commented 2 months ago

The root cause is missing error handling, for example templates.js#L63. If the entity doesn't have annotation @ODM.entityName, it will return undefined. I assume all similar undefined appearance will be same.