Skip to content

feat: implement configuration parsing and v1-to-v2 migration logic for mcp-toolbox#3034

Open
skbss wants to merge 1 commit intogoogleapis:mainfrom
skbss:main_add_new_line_instead_of_line_seperators
Open

feat: implement configuration parsing and v1-to-v2 migration logic for mcp-toolbox#3034
skbss wants to merge 1 commit intogoogleapis:mainfrom
skbss:main_add_new_line_instead_of_line_seperators

Conversation

@skbss
Copy link
Copy Markdown

@skbss skbss commented Apr 12, 2026

Description

Should include a concise description of the changes (bug or feature), it's
impact, along with a summary of the solution

PR Checklist

Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

@skbss skbss requested a review from a team as a code owner April 12, 2026 05:17
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds logic to the configuration processor to normalize 'description' fields by replacing newlines with spaces and trimming whitespace. It also includes a new 'issues.json' file. Reviewers identified that the string normalization could be improved by using 'strings.Fields' and 'strings.Join' to better handle Windows-style line endings and multiple consecutive spaces. Furthermore, the 'issues.json' file should be removed as it appears to be an accidental inclusion of metadata.

Comment on lines +246 to +248
if s, ok := item.Value.(string); ok {
item.Value = strings.TrimSpace(strings.ReplaceAll(s, "\n", " "))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation only handles Unix-style newlines (\n). If the input configuration uses Windows-style line endings (\r\n), the carriage return character (\r) will remain in the description string. Additionally, replacing newlines with spaces can result in multiple consecutive spaces if the original text had indentation or trailing spaces. Using strings.Fields combined with strings.Join is a more robust way to normalize the description into a single line with single spaces, as it automatically handles all types of whitespace and line endings.

Suggested change
if s, ok := item.Value.(string); ok {
item.Value = strings.TrimSpace(strings.ReplaceAll(s, "\n", " "))
}
if s, ok := item.Value.(string); ok {
item.Value = strings.Join(strings.Fields(s), " ")
}

Comment on lines +1 to +4
{
"number": 3023,
"title": "migration add \\n instead of separating lines for description"
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This file appears to be an accidental inclusion in the repository. It contains issue metadata that should typically be part of the pull request description or tracked in an external system, rather than being committed as a source file. Please remove it if it is not required for the application's functionality.

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.

2 participants