Skip to content

Conversation

@d3xter666
Copy link
Member

JIRA: CPOUI5FOUNDATION-904

@d3xter666 d3xter666 marked this pull request as draft December 11, 2025 07:33
@cla-assistant
Copy link

cla-assistant bot commented Dec 11, 2025

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link

coveralls commented Dec 11, 2025

Coverage Status

coverage: 94.336%. remained the same
when pulling 426458e on jsdoc-to-markdow
into bbf3d69 on main.


// Recursively handle the inner type
if (isComplexTypeExpression(innerType)) {
result += linkComplexType(innerType, null, classString.replace(' class="', '').replace('"', ''));

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High documentation

This replaces only the first occurrence of '"'.

Copilot Autofix

AI about 1 month ago

In general, to fix this kind of problem you should either use a proper sanitization/escaping library or, if you’re just doing simple character stripping, use a regular expression with the global (g) flag so that all occurrences are replaced, not just the first. When removing quotation marks or similar characters, make sure to handle all instances so partially-sanitized strings cannot cause malformed output.

In this concrete case, the intent on line 748 is to turn something like classString (probably class="SomeClass") into just the inner value (SomeClass) for use as a class attribute when generating links for complex types. The current code does this by first removing the substring class=" and then removing only the first remaining " character. To make this robust, we should (a) remove the leading class=" as now, and then (b) remove all remaining double quotes using a regex with the global flag. This preserves existing behavior for simple cases, but correctly handles any classString with more than one double quote.

Concretely, in internal/documentation/jsdoc/docdash/publish.js, within linkGenericType, change line 748 so that the second .replace uses a global regex: .replace(/"/g, '') instead of .replace('"', ''). No new imports or helper methods are required.

Suggested changeset 1
internal/documentation/jsdoc/docdash/publish.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/internal/documentation/jsdoc/docdash/publish.js b/internal/documentation/jsdoc/docdash/publish.js
--- a/internal/documentation/jsdoc/docdash/publish.js
+++ b/internal/documentation/jsdoc/docdash/publish.js
@@ -745,7 +745,7 @@
 
     // Recursively handle the inner type
     if (isComplexTypeExpression(innerType)) {
-        result += linkComplexType(innerType, null, classString.replace(' class="', '').replace('"', ''));
+        result += linkComplexType(innerType, null, classString.replace(' class="', '').replace(/"/g, ''));
     } else {
         let innerUrl = helper.longnameToUrl[innerType];
         if (innerUrl) {
EOF
@@ -745,7 +745,7 @@

// Recursively handle the inner type
if (isComplexTypeExpression(innerType)) {
result += linkComplexType(innerType, null, classString.replace(' class="', '').replace('"', ''));
result += linkComplexType(innerType, null, classString.replace(' class="', '').replace(/"/g, ''));
} else {
let innerUrl = helper.longnameToUrl[innerType];
if (innerUrl) {
Copilot is powered by AI and may make mistakes. Always verify output.
}
}
},
"githubSourceBaseUrl": "https://github.com/UI5/cli/blob/main/pacakges/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"githubSourceBaseUrl": "https://github.com/UI5/cli/blob/main/pacakges/"
"githubSourceBaseUrl": "https://github.com/UI5/cli/blob/main/packages/"

@@ -1,4 +1,4 @@
(function(window) {
nbpm(function(window) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

CONTRIBUTING.md Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

@d3xter666 d3xter666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And one general comment:

We shall not modify the content within packages/ folder, nor delete anything from there. That will impact the UI5 CLI functionality, tests and docs

if (process.argv[2] == "gh-pages") {
// Read package.json of packages/builder
const builderJson = JSON.parse(fs.readFileSync("tmp/packages/@ui5/builder/package.json"));
packageTagName = `https://github.com/UI5/cli/blob/cli-v${builderJson["version"]}/packages/`;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is invalid, because the previous versions of UI5 CLI are not within a monorepo, but separate packages and they have separate repositories. There is no packages folder, except for the main branch

Comment on lines 116 to 119
for (const file of fs.readdirSync(outputDirectory)) {
fs.rmSync(path.join(outputDirectory, file));
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the rimraf package and clean the whole dir

}

async function checkDeadlinks(link, sourcePath) {
if ((await fetch(link)).status != 200) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be within the 4xx range. Please take a look here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status

@@ -0,0 +1,92 @@
## Modified by SAP
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this package copied here, but not used as dependency to the documentation?

Comment on lines 87 to 89
* <pre>
* this["name"] = name;
* </pre>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how our current JSDoc works. Can we handle this in the transofrmation?
I know that if we leave it like that here, the vitepress build might fail

@werwolf2303 werwolf2303 force-pushed the jsdoc-to-markdow branch 7 times, most recently from 0d5c362 to 075a37e Compare January 20, 2026 08:15
Fixes

Modify config.ts for vitepress

Remove file

Layout and functionality improvements

Vitepress build fix and search improvements

Move to different approach

Fixes and move jsdoc to cli

Add back apidocs.css and linking fixes

Fix internal linking

Fix external links

Fixes

Fix links attempt and disable next/prev in api docs

Fix width and build directory and remove pagefind

Don't generate js.md files
@matz3
Copy link
Member

matz3 commented Jan 20, 2026

There are still some dead links. You can find them by searching for .md" within ./internal/documentation/dist/api. Note that some of those links are correct (e.g. links to a RFC document on GitHub).

Please continue to create new commits, as that makes reviewing changes easier. We can squash all commits again after all open points have been addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants