Skip to content

BUG - @sap-ux/project-access doesnt return mock server config services when defined in config.js #3907

@IainSAP

Description

@IainSAP

Description

When a mock server config is using externally configured services from a config.js these are not returned in the services property of the mock server config. This means that the mock server data path cannot be determined for a specific service these services cannot be updated. Only the yaml file config is considered but all of the configuration is required.

Steps to Reproduce

Configure a mock server ui5-mock.yaml file in Fiori app like so:

- name: sap-fe-mockserver
      beforeMiddleware: csp
      configuration:
        mockFolder: ./webapp/localService
        watch: true
        debug: true
        annotations: []
        mountPath: /

Place the a file named config.js into the folder: ./webapp/localService:

[
    {
        "urlPath": "/sap/opu/odata4/sap/service/path1/0001/",
        "name": "",
        "metadataPath": "./mainService/metadata.xml",
        "mockdataPath": "./mainService/data",
        "generateMockData": false
    },
    {
        "urlPath": "urlPath": "/sap/opu/odata4/sap/service/path2/0001/",,
        "name": "",
        "metadataPath": "./service2.xml",
        "mockdataPath": "./service2/data"
    },
]

Calling the @sap/ux/project-access function getMockServerConfig returns :

{
    "mockFolder": "./webapp/localService/",
    "watch": true,
    "debug": true,
    "annotations": []
}

None of the services are returned and so the mock data paths cannot be discovered for data writing. Additionally there is no way to directly update these services using ui5-mock-config-writer APIs, for example to update a specific service with the resolveExternalServiceReferences: true reference required for loading of value helps and code lists by the mock data server.

Expected results

All service configs are returned.

Actual results

No service configs are returned

Screenshots

If applicable, add screenshots to help explain the problem.

Version/Components/Environment

Add any other context about the problem here
OS:

  • Mac OS
  • Windows
  • Other

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions