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 - @sap-ux/fe-mockserver-plugin-cds insists on file extension when USING other cds files #833

Closed heimwege closed 1 month ago

heimwege commented 2 months ago

Description

In case the cds file in metadataPath uses other cds files e.g.

using {CapFeTsSampleService} from '../../srv/cap-fe-ts-sample-service'; // <-- .cds missing here

annotate CapFeTsSampleService.Samples with @(

starting the mockserver results in a

ERR! server:ux-fe-mockserver Error: ENOENT: no such file or directory, open '<localPath>\cap-fe-ts-sample2\srv\cap-fe-ts-sample-service'
ERR! server:ux-fe-mockserver  [Error: ENOENT: no such file or directory, open '<localPath>\cap-fe-ts-sample2\srv\cap-fe-ts-sample-service'] {
ERR! server:ux-fe-mockserver   errno: -4058,
ERR! server:ux-fe-mockserver   code: 'ENOENT',
ERR! server:ux-fe-mockserver   syscall: 'open',
ERR! server:ux-fe-mockserver   path: '<localPath>\\cap-fe-ts-sample2\\srv\\cap-fe-ts-sample-service'
ERR! server:ux-fe-mockserver }

⚠️  Process Failed With Error

Error Message:
Failed to start {
    "urlPath": "/odata/v4/CapFeTsSampleService",
    "metadataPath": "<localPath>\\cap-fe-ts-sample2\\app\\samples\\ui-annotations.cds",
    "mockdataPath": "<localPath>\\cap-fe-ts-sample2\\app\\samples\\webapp\\localService\\mockdata",
    "_internalName": "CapFeTsSampleService"
}

Although cds build is fine with that notation, the @sap-ux/fe-mockserver-plugin-cds insists on the explicit file extension

using {CapFeTsSampleService} from '../../srv/cap-fe-ts-sample-service.cds'; 

annotate CapFeTsSampleService.Samples with @(

That seems to work for both, the mockserver and cds build.

Expected results

Same behavior as cds build (fallback to .cds).

Actual results

Mockserver fails to start

Version/Components/Environment

Add any other context about the problem here OS:

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}

heimwege commented 1 month ago

fixed with 1.2.1 🥳