SAP / open-ux-odata

Enable community collaboration to jointly promote and facilitate best in class framework and tooling capabilities when working with OData services.
Apache License 2.0
51 stars 10 forks source link

BUG - Service document (at service root) does not contain the available entities #820

Closed tobiasqueck closed 2 months ago

tobiasqueck commented 3 months ago

Related Feature

Feature request: no idea

Description

When using the @sap-ux/axios-extension to fetch available OData v2 services, we fetch the service document of the catalog service first to determine which entity set we need to use to get the serviced recommended/available for UI development. While testing it with the mock server we noticed that it is not correctly returning the entities and that it doesn't support the $format=json parameter.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a project with any metadata.xml
  2. Call the mocked service root with the url parameter $format=json
  3. See response

Expected results

A JSON document like

{
  "d": {
      "EntitySets": [
      "Annotations",
      "Vocabularies",
      "ServiceCollection",
      "ServiceNames",
      "TagCollection",
      "EntitySetCollection",
      "CatalogCollection",
      "RecommendedServiceCollection",
      "ScopedServiceCollection"
    ]
  }
}

Actual results

<app:service xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData" xml:lang="en" xml:base="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2">
  <app:workspace> </app:workspace>
  <atom:link rel="self" href="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2"/>
  <atom:link rel="latest-version" href="/sap/opu/odata/IWFND/CATALOGSERVICE;v=2"/>
</app:service>

Two issues:

Root Cause Analysis

Problem

{describe the problem}

Fix

{describe the fix}

Why was it missed

{Some explanation why this issue might have been missed during normal development/testing cycle}

How can we avoid this

{if we donโ€™t want to see this type of issues anymore what we should do to prevent}

nlunets commented 3 months ago

Do you have a sample V2 service where i could check the result ?

tobiasqueck commented 3 months ago

I used the v2 catalog service at /sap/opu/odata/IWFND/CATALOGSERVICE;v=2. You should find it on any ABAP system

nlunets commented 2 months ago

This is fixed