Skip to content

feat: implement proper API versioning strategy (/api/v1/) (#304)#369

Open
Harshithk951 wants to merge 5 commits into
viru0909-dev:mainfrom
Harshithk951:feat/api-versioning-strategy
Open

feat: implement proper API versioning strategy (/api/v1/) (#304)#369
Harshithk951 wants to merge 5 commits into
viru0909-dev:mainfrom
Harshithk951:feat/api-versioning-strategy

Conversation

@Harshithk951
Copy link
Copy Markdown
Contributor

Description

Fixes #304

This PR introduces a robust URI-based API versioning strategy to prevent breaking changes in the future, as discussed in the issue.

Changes Included

  • Backend: Configured a global API prefix (/api/v1) using WebMvcConfigurer to automatically apply to all @RestControllers.
  • Backend Refactoring: Stripped the redundant /api prefix from all individual controller @RequestMapping annotations to maintain clean paths and avoid /api/v1/api/....
  • Frontend: Updated the Axios centralized API service (src/services/api.js) and other direct API consumers to use the new /api/v1/ endpoints.
  • Docs: Added an API Versioning Strategy section to the README.md.

Testing Done

  • Validated that all frontend requests correctly hit the /api/v1 base.
  • Verified that all backend endpoints map correctly to the new prefix.
  • Double-checked CI/CD .github/workflows/deploy.yml compatibility (no changes needed as it triggers on push).

Add comprehensive pytest coverage for the format_research_for_synthesis()
helper function in synthesizer.py.

Test cases:
- test_correct_numbered_formatting: verifies sub-question numbering,
  source uppercasing, answer inclusion, and separator formatting
- test_ignores_empty_answers: confirms entries with empty string or
  None answers are excluded from output
- test_empty_input_list: validates empty list returns empty string
- test_single_result: ensures no separator for single-item output
- test_preserves_original_numbering: verifies skipped entries retain
  their original position numbers (not re-indexed)

Uses unittest.mock.patch.dict to mock GROQ_API_KEY for CI-friendly
execution without requiring a .env file.

Closes viru0909-dev#286
- Add sanitizer.py with HTML stripping, prompt injection filtering, and URL validation
- Harden LegalQuery Pydantic model with field validators for XSS and length checks
- Sanitize user input before injecting into AI prompts (decomposer, synthesizer, deep research)
- Add XssSanitizationFilter.java to escape HTML in all incoming JSON request bodies
- Register XSS filter in SecurityConfig.java filter chain
- Add 35 unit tests for sanitizer module (all passing)

Closes viru0909-dev#309
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

@Harshithk951 is attempting to deploy a commit to the CodeBlooded's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nyaysetu Ready Ready Preview, Comment May 17, 2026 6:12am

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.

Implement Proper API Versioning Strategy

1 participant