Skip to content

fix: enhance JSON5 parsing error handling in RouterParserUtil - #1611

Merged
tcorral merged 5 commits into
developfrom
fix/#1610
Aug 29, 2025
Merged

tcorral merged 5 commits into
developfrom
fix/#1610

Conversation

@tcorral

@tcorral tcorral commented Aug 28, 2025 •

Copy link
Copy Markdown
Collaborator
  • Added error handling for JSON5 parsing in the cleanRawRouteParsed method to log detailed error messages when parsing fails due to special characters in file paths or route configurations.
  • Improved the cleanRawRoute method to handle unescaped characters and malformed string concatenations that could lead to parsing issues.
  • Introduced a new test suite to validate the handling of routes with special characters, ensuring that documentation generation does not fail due to these issues.

We do expect these changes to fix all the JSON5 parsing errors: #1610 , #1594 , #1581 , #1573 #1550 and #1533

- Added error handling for JSON5 parsing in the cleanRawRouteParsed method to log detailed error messages when parsing fails due to special characters in file paths or route configurations.
- Improved the cleanRawRoute method to handle unescaped characters and malformed string concatenations that could lead to parsing issues.
- Introduced a new test suite to validate the handling of routes with special characters, ensuring that documentation generation does not fail due to these issues.

We do expect these changes to fix all the JSON5 parsing errors: #1610, #1594, #1581, #1573 and #1550
@tcorral
tcorral requested a review from vogloblinsky August 28, 2025 14:11
@tcorral

tcorral commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator Author

…RouterParserUtil

- Enhanced the RouterParserUtil to correctly parse template literals and fix issues with malformed string concatenations.
- Updated tests to validate the handling of new template literal routes and ensure that JSON5 parsing errors are properly managed.
- Ensured that the application does not crash with complex character combinations in routes, addressing new edge cases.

These changes aim to resolve additional parsing issues related to template literals and improve overall robustness in route handling.
@vogloblinsky

Copy link
Copy Markdown
Contributor

@vogloblinsky vogloblinsky 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.

Perfect, thanks for the work

tomas_backbase added 3 commits August 29, 2025 15:28
- Updated the route rendering logic to handle cases where the component name is not provided, defaulting to the path or name.
- Added conditional checks to display the component name when it includes 'Component' for better clarity in the output.
- Enhanced the overall robustness of the route display by ensuring that both path and name are utilized effectively.

These changes aim to improve the user experience by providing clearer route information in the application.
…for application

- Introduced a new routing module (AppRoutingModule) to manage application routes, including dynamic and nested routes.
- Created constants for route paths and types to enhance route management and clarity.
- Added utility functions for lazy loading modules and route configuration.
- Established a basic application module (AppModule) to bootstrap the application with routing capabilities.
- Included a TypeScript configuration file for improved type checking and compilation settings.

These changes lay the groundwork for a structured routing system, improving navigation and modularity within the application.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@tcorral
tcorral marked this pull request as ready for review August 29, 2025 14:40
@tcorral
tcorral merged commit 8e048e2 into develop Aug 29, 2025
vogloblinsky added a commit that referenced this pull request May 24, 2026
Replace cleanRawRoute() escaping regexes (introduced in PR #1611) that
were corrupting valid path strings, and add proper handling for all
TypeScript expression patterns that caused JSON5 parse failures.

Changes:
- Remove 4 destructive escaping regexes from cleanRawRoute()
- Add Step 0: convert modern lazy-loading arrow syntax to "path#Module"
- Add Step 1: strip template literal interpolations ${VAR}
- Add Steps 2-3: merge adjacent string literals and absorb identifier
  chains joined by +
- Add Steps 4-5: replace arrow function expressions with "[Function]"
- Add replaceBlockArrowFunctions() helper for block-body arrow fns
- Extract routeItem.redirectTo in constructRoutesTree() try block
  (enums resolved by cleanFileDynamics before CodeGenerator serialization)
- Fix enumMappings keys: APP_ENUMS.home and APP_ENUM.home

closes #1610
closes #1594
closes #1581
closes #1550
closes #1533
closes #1346
closes #1287
closes #1426
closes #1484
closes #1480
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