Skip to content

Conversation

@xkotami
Copy link

@xkotami xkotami commented Nov 22, 2025

circular reference was present in calls including bookings/user objects.

@JsonIgnore ignores the bookings field in User class.

Tests ok

Summary by CodeRabbit

  • Bug Fixes
    • Updated user profile API responses to exclude booking information from the serialized data.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Walkthrough

Added Jackson annotations to the User model to control JSON serialization behavior. The bookings field is now annotated with @JsonIgnore to exclude it from JSON serialization responses.

Changes

Cohort / File(s) Summary
Jackson serialization configuration
src/main/java/org/justjava/gymcore/model/User.java
Added JsonIgnore and JsonIgnoreProperties imports from Jackson. Annotated bookings field with @JsonIgnore to prevent serialization of booking associations in JSON responses.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit's note on JSON tunes,
The bookings now stay in the shadows—
No more shall they be exposed to light,
When User data travels through the night.
Simple annotations, yet profound! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add @JsonIgnore to prevent circular reference' directly and clearly describes the main change: adding a @JsonIgnore annotation to resolve a circular reference issue in JSON serialization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/java/org/justjava/gymcore/model/User.java (1)

47-49: @JsonIgnore fixes recursion but globally hides bookings from User JSON

Annotating bookings with @JsonIgnore is a straightforward way to prevent the circular reference and should resolve the serialization recursion you described. The tradeoff is that User JSON will now never include bookings, even on endpoints where it might be useful.

If you later need bookings in some responses, consider:

  • Using DTOs for user payloads, or
  • Using Jackson features like @JsonManagedReference/@JsonBackReference or @JsonIdentityInfo to break the cycle more selectively.

For this PR’s stated goal (eliminate circular reference), the change looks good.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17aa47e and d7cda1e.

📒 Files selected for processing (1)
  • src/main/java/org/justjava/gymcore/model/User.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (1)
src/main/java/org/justjava/gymcore/model/User.java (1)

4-5: Imports align with new serialization behavior

Adding the Jackson imports here is consistent with the new @JsonIgnore usage on bookings and keeps concerns localized to the model. No issues from a correctness standpoint.

@ozkanpakdil
Copy link
Collaborator

I know from first line it looks okay to merge this but I wonder is it possible to change the architecture to not to give jsonignore, I am thinking maybe there is a better approach thats why I am asking.

@xkotami
Copy link
Author

xkotami commented Nov 22, 2025

I was wondering the same as well. I'm currently looking up ways around this because using @jsonignore can hinder future functionality

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