feat: Add rule 'No absolute DataSource Uri' for CF platform#1013
feat: Add rule 'No absolute DataSource Uri' for CF platform#1013aleksandr-suvorov wants to merge 2 commits intoUI5:mainfrom
Conversation
|
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 |
|
I think the check for an existing service configuration in the "sap.cloud" section is meant as a safeguard here. 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. |
|
I see, thanks. So this check should only be applied if Btw. what happens if an absolute URL is used on CF? I.e. what makes this rule necessary? Is this a common issue? |
|
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 |
|
For https://github.com/SAP/ui5-task-adaptation we require prerequisites among others to be validated for CF, for example:
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. |
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: