Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: retrieve validation codes #124

Merged
merged 1 commit into from
Aug 16, 2024
Merged

Conversation

brunopacheco1
Copy link
Collaborator

@brunopacheco1 brunopacheco1 commented Aug 16, 2024

Summary by Sourcery

Refactor error handling to use structured ValidationWarning objects instead of plain error messages, update exception classes and OpenAPI specifications accordingly, and adjust tests to validate the new error response structure.

Enhancements:

  • Refactor error handling in the SubmitApplicationService and AcceptTermsService to use ValidationWarning objects instead of formatted error messages.
  • Update the ApplicationSubmissionException and AcceptTermsException to store a list of ValidationWarning objects instead of error messages.
  • Modify the OpenAPI specifications to reflect changes in error response structures, replacing errorMessages with validationWarnings.

Tests:

  • Update tests for SubmitApplication and AcceptTerms to validate the new error response structure using ValidationWarning objects.
  • Refactor test setup in AcceptTermsServiceTest to use builder pattern for creating command and response objects.

Copy link

sourcery-ai bot commented Aug 16, 2024

Reviewer's Guide by Sourcery

This pull request implements changes to improve error handling and validation in the application submission and terms acceptance processes. The main focus is on restructuring the error responses to include more detailed validation warnings, which will be useful for the frontend to display appropriate error messages. The changes span across multiple files, including test classes, service classes, exception classes, and OpenAPI specifications.

File-Level Changes

Files Changes
src/main/java/io/github/genomicdatainfrastructure/daam/services/SubmitApplicationService.java Refactored error handling in SubmitApplicationService to use ValidationWarning objects instead of string error messages
src/main/java/io/github/genomicdatainfrastructure/daam/services/AcceptTermsService.java Updated AcceptTermsService to use ValidationWarning objects for error handling
src/main/java/io/github/genomicdatainfrastructure/daam/exceptions/ApplicationSubmissionException.java
src/main/java/io/github/genomicdatainfrastructure/daam/exceptions/AcceptTermsException.java
Modified ApplicationSubmissionException and AcceptTermsException to use ValidationWarning objects
src/main/openapi/daam.yaml
src/main/openapi/rems.yaml
Updated OpenAPI specifications (daam.yaml and rems.yaml) to reflect changes in error response structure
src/test/java/io/github/genomicdatainfrastructure/daam/api/SubmitApplicationTest.java
src/test/java/io/github/genomicdatainfrastructure/daam/api/AcceptTermsTest.java
src/test/java/io/github/genomicdatainfrastructure/daam/services/AcceptTermsServiceTest.java
Refactored test classes to use the new error response structure with ValidationWarning objects
src/main/java/io/github/genomicdatainfrastructure/daam/api/ApplicationSubmissionExceptionMapper.java
src/main/java/io/github/genomicdatainfrastructure/daam/api/AcceptTermsExceptionMapper.java
Updated exception mappers to use the new error response structure
src/test/resources/mappings/accept_terms_success_false.json
src/test/resources/mappings/submit_application_for_success_false.json
Modified test resources to include more detailed error responses

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @brunopacheco1 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding more comprehensive JavaDoc comments to explain the changes in error handling, especially in the SubmitApplicationService and AcceptTermsService classes.
  • The PR introduces many new imports in some files. Consider if some of these classes can be refactored to reduce coupling and improve separation of concerns.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@brunopacheco1 brunopacheco1 merged commit 64d443a into main Aug 16, 2024
3 checks passed
@brunopacheco1 brunopacheco1 deleted the retrieve-validation-codes branch August 16, 2024 09:51
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