Skip to content

feat: Add rule 'No absolute DataSource Uri' for CF platform#1013

Draft
aleksandr-suvorov wants to merge 2 commits intoUI5:mainfrom
aleksandr-suvorov:feat-no-absolute-data-source-uri
Draft

feat: Add rule 'No absolute DataSource Uri' for CF platform#1013
aleksandr-suvorov wants to merge 2 commits intoUI5:mainfrom
aleksandr-suvorov:feat-no-absolute-data-source-uri

Conversation

@aleksandr-suvorov
Copy link

Thank you for your contribution! 🙌

To get it merged faster, kindly review the checklist below:

Pull Request Checklist

According to Best Practices oDataSources uri shouldn't start with a leading slash / - it must be relative to the base url, see:

@cla-assistant
Copy link

cla-assistant bot commented Feb 18, 2026

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

Coverage Status

coverage: 86.827% (+0.05%) from 86.782%
when pulling 1507dba on aleksandr-suvorov:feat-no-absolute-data-source-uri
into 9236745 on UI5:main.

@RandomByte
Copy link
Member

How sure can we be that this autofix won't break applications? I suspect that many absolute URLs would resolve incorrectly when removing the leading slash without considering the location of the app. For example most of our CAP sample projects use absolute URLs that would break the app: https://github.com/SAP-samples/ui5-cap-event-app/blob/85c2557080f2945727ba0cc2b932add808a19c99/packages/ui-admin/webapp/manifest.json#L15

I would expect this restriction to be at least mentioned, but ideally validated in the manifest schema.

UI5 MCP server currently does not allow for creating apps with relative paths, only absolute: https://github.com/UI5/mcp-server/blob/5f678208e3c03f35eaee57c1c6cccfe6ce26c22d/src/tools/create_ui5_app/create_ui5_app.ts#L87

CC: @akudev

@codeworrior
Copy link
Member

I think the check for an existing service configuration in the "sap.cloud" section is meant as a safeguard here.
Would however be nice to refer to a documentation that proves this check to be sufficient.

Expressing / enforcing something like this in the schema is IMO nearly impossible with JSON schema as one cannot describe restrictions based on siblings in the JSON tree - at least to my knowledge.

@RandomByte
Copy link
Member

I see, thanks. So this check should only be applied if "sap.cloud".service is set to a string? A comment in the code would help understand this connection better.

Btw. what happens if an absolute URL is used on CF? I.e. what makes this rule necessary? Is this a common issue?

@flovogt
Copy link
Member

flovogt commented Feb 18, 2026

For CF it is required to ZIP the build result and therefore usually the ui5-task-zipper is used which has a dedicated logic to remove the heading slash. See https://github.com/petermuessig/ui5-ecosystem-showcase/blob/main/packages/ui5-task-zipper/lib/zipper.js#L30-L38

@flovogt flovogt self-assigned this Feb 25, 2026
@flovogt flovogt added detection An issue related to detection capabilities autofix An issue related to the autofix capabilities labels Feb 25, 2026
@aleksandr-suvorov
Copy link
Author

For https://github.com/SAP/ui5-task-adaptation we require prerequisites among others to be validated for CF, for example:

  1. Restrict use of deprecated sap.ui.loadLibrary() and sap.ui.getCore().loadLibrary();
  2. Validation of forward slashes in dataSources uri.

Validation 1. is already implemented in ui5Linter, so the 2. is necessary to be implemented in order to have prerequisites in one place - linting. Using ui5-task-zipper is also a good option, but it distributes meeting prerequisites in 2 different places.

@aleksandr-suvorov aleksandr-suvorov marked this pull request as draft February 26, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autofix An issue related to the autofix capabilities detection An issue related to detection capabilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants