π Validate Code Input in EditorComponent π‘οΈ
π Description
Add input validation to EditorComponent to prevent empty or invalid code submissions to the backend. This ensures security by reducing the risk of processing malformed input and improves user experience by providing immediate feedback. Validation is a critical step to align with the projectβs focus on security and usability.
π― Objective
Implement input validation in EditorComponent to check for empty or non-string code before triggering compilation or testing.
π Structure
- Directory:
apps/frontend/src/app/components/editor/
- Files:
apps/frontend/src/app/components/editor/editor.component.ts
apps/frontend/src/app/components/editor/editor.component.html
- Expected structure:
apps/frontend/
βββ src/
β βββ app/
β β βββ components/
β β β βββ editor/
β β β βββ editor.component.ts
β β β βββ editor.component.html
β
Requirements
- Add validation in
compile() and test() methods of editor.component.ts:
- Check if
code is a non-empty string using code.trim().
- Display an error message in the output panel if validation fails (e.g., βError: Code cannot be emptyβ).
- Update
editor.component.html to bind the output panel to the error message.
- Ensure validation occurs before calling
CompilerService.
- Test validation with empty and non-string inputs.
- Commit changes with a message like
feat: add code input validation.
- Push changes to the GitHub repository.
π Expected Outcomes
EditorComponent prevents submission of empty or invalid code.
- Users see clear error messages for invalid inputs.
- Backend API calls are only made for valid code.
- Changes are committed and pushed to GitHub.
π References
π Notes
- Keep validation simple but effective for this milestone.
- Consider expanding validation rules (e.g., code length limits) in future iterations.
π Validate Code Input in EditorComponent π‘οΈ
π Description
Add input validation to
EditorComponentto prevent empty or invalid code submissions to the backend. This ensures security by reducing the risk of processing malformed input and improves user experience by providing immediate feedback. Validation is a critical step to align with the projectβs focus on security and usability.π― Objective
Implement input validation in
EditorComponentto check for empty or non-string code before triggering compilation or testing.π Structure
apps/frontend/src/app/components/editor/apps/frontend/src/app/components/editor/editor.component.tsapps/frontend/src/app/components/editor/editor.component.htmlβ Requirements
compile()andtest()methods ofeditor.component.ts:codeis a non-empty string usingcode.trim().editor.component.htmlto bind the output panel to the error message.CompilerService.feat: add code input validation.π Expected Outcomes
EditorComponentprevents submission of empty or invalid code.π References
π Notes