Skip to content

Handled the file name length while api model configuration, and added…#4390

Merged
shahanemahesh merged 4 commits into
Releases/Official-Releasefrom
Issue_58086
Dec 22, 2025
Merged

Handled the file name length while api model configuration, and added…#4390
shahanemahesh merged 4 commits into
Releases/Official-Releasefrom
Issue_58086

Conversation

@shahanemahesh

@shahanemahesh shahanemahesh commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

… length to subfolder creation

Description

Type of Change

  • Bug fix - [ ] New feature - [ ] Breaking change - [ ] Plugin update

Checklist

  • PR description clearly describes the changes
  • Target branch is correct (master for features, Releases/* for fixes)
  • Latest code from target branch merged
  • No commented/junk code included
  • No new build warnings or errors
  • All existing unit tests pass
  • New unit tests added for new functionality
  • Cross-platform compatibility verified (Windows/Linux/macOS)
  • CI/CD pipeline passes
  • Code follows project conventions (Act{Platform}{Type}, {Platform}Driver)
  • Repository objects use [IsSerializedForLocalRepository] where needed
  • Error handling uses Reporter.ToLog() pattern
  • Documentation updated for user-facing changes
  • Self-review completed and code review comments addressed

Summary by CodeRabbit

  • Updates
    • API model display names are now truncated to a maximum of 50 characters for consistency.
    • Single-line input boxes now enforce a 30-character maximum to prevent overly long entries.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Two localized changes: API model name generation now uses Operation.Summary converted to string and truncated to 50 characters with a fallback to OperationId; and a textbox in an input dialog gains a MaxLength="30" constraint to limit user input.

Changes

Cohort / File(s) Summary
API Model Name Generation
Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
Modified GenerateBasicModel to set AAM.Name from Operation.Summary converted to string and truncated to 50 characters; if the result is null/whitespace, fallback to OperationId.
UI Input Constraint
Ginger/GingerCore/GeneralLib/InputBoxWindow.xaml
Added MaxLength="30" to ValueTextBox to restrict runtime user input length.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check null/empty/whitespace handling and trimming logic in OpenApiBase.GenerateBasicModel.
  • Verify MaxLength="30" does not conflict with validations or required input lengths elsewhere.

Poem

🐰 I nibble summaries down to fifty bright chars,
I tuck textbox inputs to thirty, not far.
Snip, trim, and tidy with a hop and a hum,
Short names, short lines — neat work, yum-yum! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description section is completely empty with only a comment placeholder, providing no details about the changes despite the template requiring a clear description. Add a detailed description explaining the API model name truncation, input field max length changes, and rationale for these modifications.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title is incomplete and cut off mid-sentence (ends with 'and added…'), making it vague and not fully descriptive of the actual changes. Complete the title to clearly describe both changes: 'Truncate API model names to 50 characters and add max length validation to input fields'.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Issue_58086

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a62a29 and c44a8df.

📒 Files selected for processing (2)
  • Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
  • Ginger/GingerCore/GeneralLib/InputBoxWindow.xaml
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Reporter.ToLog(eLogLevel.ERROR, message) for logging errors

Files:

  • Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
🧠 Learnings (3)
📚 Learning: 2025-12-18T05:29:42.896Z
Learnt from: AmanPrasad43
Repo: Ginger-Automation/Ginger PR: 4385
File: Ginger/GingerCoreNET/Run/Excels/ExcelNPOIOperations.cs:468-475
Timestamp: 2025-12-18T05:29:42.896Z
Learning: In the Ginger codebase, assume file extensions are lowercase (e.g., .xlsx, .xls). Do not perform case-insensitive extension checks (such as StringComparison.OrdinalIgnoreCase) when using EndsWith() or similar methods to verify file extensions; rely on lowercase comparisons or convert to lowercase first. This ensures consistency and avoids unnecessary case-insensitive comparisons across C# source files.

Applied to files:

  • Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
📚 Learning: 2025-08-26T07:40:08.345Z
Learnt from: AmanPrasad43
Repo: Ginger-Automation/Ginger PR: 4285
File: Ginger/Ginger/Actions/ActionEditPages/ActSecurityTestingEditPage.xaml:23-23
Timestamp: 2025-08-26T07:40:08.345Z
Learning: In the Ginger codebase ActSecurityTestingEditPage.xaml file, the large bottom margin of 530 on the "Acceptable Alerts" label (Margin="10,10,0,530") is intentional design choice, not an error.

Applied to files:

  • Ginger/GingerCore/GeneralLib/InputBoxWindow.xaml
📚 Learning: 2025-12-18T05:19:56.687Z
Learnt from: AmanPrasad43
Repo: Ginger-Automation/Ginger PR: 4385
File: Ginger/Ginger/Actions/ActionEditPages/ActExcelEditPage.xaml:0-0
Timestamp: 2025-12-18T05:19:56.687Z
Learning: In XAML DataTriggers, enum properties can be compared to string values because WPF automatically converts enums to strings during evaluation. This pattern is valid for XAML files like ActExcelEditPage.xaml where eExcelActionType is compared to string literals such as "ReadCellByIndex" or "GetSheetDetails". Apply this guideline broadly to XAML files that bind to enum properties; verify that such comparisons behave as expected in the specific UI components and avoid relying on string literals if the enum values change.

Applied to files:

  • Ginger/GingerCore/GeneralLib/InputBoxWindow.xaml
🔇 Additional comments (1)
Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs (1)

116-121: Add duplicate name detection and logging when collision risk is detected.

Truncating Operation.Summary to 50 characters can cause naming collisions when multiple operations share the same first 50 characters and content type. While the code appends suffixes like -JSON, -XML, and -UrlEncoded for different body types, operations with identical first 50 characters and the same request body type would produce duplicate AAM.Name values.

Additionally, the avoidDuplicatesNodes parameter exists in the ParseDocument method signature but is not passed to SwaggerVer2.SwaggerTwo() or OpenApiVer3.OpenApiThree(), making duplicate detection unavailable for Swagger parsing. Consider implementing collision detection and logging when duplicate names are encountered using Reporter.ToLog(eLogLevel.ERROR, message).

Comment thread Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs Outdated
Comment thread Ginger/GingerCore/GeneralLib/InputBoxWindow.xaml

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c44a8df and 56b544a.

📒 Files selected for processing (1)
  • Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Reporter.ToLog(eLogLevel.ERROR, message) for logging errors

Files:

  • Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
🧠 Learnings (1)
📚 Learning: 2025-12-18T05:29:42.896Z
Learnt from: AmanPrasad43
Repo: Ginger-Automation/Ginger PR: 4385
File: Ginger/GingerCoreNET/Run/Excels/ExcelNPOIOperations.cs:468-475
Timestamp: 2025-12-18T05:29:42.896Z
Learning: In the Ginger codebase, assume file extensions are lowercase (e.g., .xlsx, .xls). Do not perform case-insensitive extension checks (such as StringComparison.OrdinalIgnoreCase) when using EndsWith() or similar methods to verify file extensions; rely on lowercase comparisons or convert to lowercase first. This ensures consistency and avoids unnecessary case-insensitive comparisons across C# source files.

Applied to files:

  • Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
🧬 Code graph analysis (1)
Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs (3)
Ginger/Ginger/ApplicationModelsLib/APIModels/APIModelPage.xaml.cs (1)
  • Convert (1077-1085)
Ginger/GingerCoreCommon/Repository/ApplicationModelLib/ApplicationModelBase.cs (1)
  • ToString (53-56)
Ginger/GingerCoreCommon/Repository/RepositoryFolder.cs (1)
  • ToString (87-90)
🔇 Additional comments (2)
Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs (2)

116-117: LGTM! Past review feedback addressed correctly.

The redundant Convert.ToString calls have been properly eliminated by storing the result in a variable. The implementation correctly truncates the operation summary to 50 characters and maintains the fallback to OperationId when the name is empty or whitespace.


117-117: Reconsider the 50-character truncation limit to account for subsequent suffix appending.

The 50-character limit applied at line 117 does not account for suffixes like "-JSON", "-UrlEncoded", or "-XML" that are appended afterward in OpenApiVer3.cs and SwaggerVer2.cs. This results in filenames exceeding the intended length, particularly since AAM.Name is used for repository file naming. Consider reducing the initial truncation to approximately 40-45 characters to accommodate the longest suffix ("-UrlEncoded", 11 chars) while maintaining a reasonable maximum filename length.

Comment thread Ginger/GingerAutoPilot/APIModelLib/SwaggerApi/OpenApiBase.cs
@shahanemahesh
shahanemahesh merged commit d60113c into Releases/Official-Release Dec 22, 2025
10 of 11 checks passed
@shahanemahesh
shahanemahesh deleted the Issue_58086 branch December 22, 2025 09:15
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.

1 participant