Skip to content

Fix #3957: sanitize Java identifiers from literal file ASSIGNments in API contract forge - #3965

Merged
squid-protocol merged 2 commits into
mainfrom
fix/3957-api-contract-names
Sep 28, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/3957-api-contract-names

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Resolves #3957

Defect:
The generate_rest_controller function previously built Java parameter and variable names by splitting on hyphens. When COBOL programs assigned files to literal paths (e.g., ASSIGN "./TEST-FILE"), the literal path leaked directly into the generated Spring Boot controller annotations and variable names (e.g., @RequestBody ./testFileDTO ./testFileData), which caused compilation errors.

Fix:
This PR introduces _WORD_BREAKS.split() and the capitalization utilities from cobol_to_java_names.py into the REST controller forge to properly strip all non-identifier characters. Path literals like ./TEST-FILE now safely collapse into clean camelCase Java identifiers like TestFileDTO and testFileFile, restoring full compilation for the generated API contracts.

…ontract forge

Resolves #3957 by replacing simple hyphen splits with _WORD_BREAKS.split() and capitalization utilities. This strips out non-identifier characters (like './') from file paths before converting them into @RequestBody and @RequestParam Java identifiers, ensuring the generated Spring Boot controller perfectly compiles.
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

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.

Generated REST controller does not compile when a file is ASSIGNed to a literal path ("./TEST-FILE" -> @RequestBody ./testFileDTO)

1 participant