Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat : expose endpoint to save post along with details, comments and tags #1647
feat : expose endpoint to save post along with details, comments and tags #1647
Changes from all commits
bf8cb6c
a9b5030
ea87343
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Field injection in decorator contradicts mapper's constructor injection pattern
The PostMapperDecorator implementation has several issues that contradict the best practices set in the mapper configuration:
@Autowired private TagRepository
) instead of constructor injectionSuggested improvements:
🔗 Analysis chain
Verify PostMapperDecorator implementation based on learnings.
The mapper configuration follows best practices with constructor injection, null checking, and appropriate collection mapping strategy. However, based on the retrieved learnings, ensure that the
PostMapperDecorator
follows these guidelines:Let's verify the decorator implementation:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 182
Script:
Length of output: 1542
Script:
Length of output: 2502
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai, how to use constructor injection instead of field injection in the Decorator of PostMapper defined using
MapStruct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rajadilipkolli Here's how to implement constructor injection in your MapStruct decorator:
Remove the
@Autowired
field injection and use the constructor injection instead. MapStruct will automatically wire the delegate implementation and the repository through the constructor.🔗 Analysis chain
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 770
✏️ Learnings added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai, receiving error as below, please fix
Specified decorator type has no default constructor nor a constructor with a single parameter accepting the decorated mapper type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rajadilipkolli Here's the corrected constructor pattern for the MapStruct decorator:
This follows MapStruct's requirement of having a constructor with a single parameter for the delegate mapper, while still allowing Spring to inject the TagRepository through setter injection.
✏️ Learnings added