Skip to content

feat(types): map additional post fields#1668

Merged
nbartels merged 2 commits into
devfrom
feat/post-missing-fields
May 7, 2026
Merged

feat(types): map additional post fields#1668
nbartels merged 2 commits into
devfrom
feat/post-missing-fields

Conversation

@nbartels

@nbartels nbartels commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add missing Graph API Post fields for backdated time, coordinates, live video state, and subscription state
  • Model post coordinates with documented subfields while keeping nested coords as JsonObject for flexibility
  • Cover the new Post mappings with a JSON fixture and PostTest assertions

Verification

  • mvn -Dtest=PostTest test

Summary by CodeRabbit

  • New Features
    • Post objects now include backdated publication time, live-video flag, subscription status, and detailed coordinates (geo data, IDs, tagged users, timestamp, message).
  • Tests
    • Added tests and JSON fixtures to verify parsing when those fields are present or absent, ensuring correct handling of populated and missing coordinate-related data.

@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e91f339-8e77-46f9-9c76-59b423aeac2d

📥 Commits

Reviewing files that changed from the base of the PR and between 157ac7f and af4c63f.

📒 Files selected for processing (2)
  • src/test/java/com/restfb/types/PostTest.java
  • src/test/resources/json/post-missing-fields-absence.json
✅ Files skipped from review due to trivial changes (1)
  • src/test/resources/json/post-missing-fields-absence.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/test/java/com/restfb/types/PostTest.java

📝 Walkthrough

Walkthrough

This PR extends the Post model with four new Graph API fields: backdatedTime, coordinates (a new nested type), isFbLiveVideos, and subscribed. A new Coordinates class holds checkin and location metadata. Tests and JSON fixtures validate deserialization and absence handling.

Changes

Post Model Enhancement

Layer / File(s) Summary
Post Model Fields & Coordinates Type
src/main/lombok/com/restfb/types/Post.java
Post adds backdatedTime (Date, backdated_time), coordinates (Coordinates), isFbLiveVideos (Boolean, is_fb_live_videos), and subscribed (Boolean). New nested static Coordinates extends AbstractFacebookType and declares checkinId, authorUid, pageId, targetId, targetHref, coords (JsonObject), taggedUids, timestamp, message, and targetType.
Tests & Fixtures
src/test/resources/json/post-missing-fields.json, src/test/resources/json/post-missing-fields-absence.json, src/test/java/com/restfb/types/PostTest.java
Adds post-missing-fields.json and post-missing-fields-absence.json fixtures. Adds tests checkMissingPostFields (validates populated mapping) and checkMissingPostFields_absence (validates null/empty handling for absent fields and coordinates).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

type: missing field/type

Poem

🐰 Tiny paws tap keys to say,
New fields hop into Post today,
Coordinates nest, timestamps align,
Booleans blink — the mappings shine,
Tests cheer softly: "Deserialise away!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(types): map additional post fields' directly and clearly summarizes the main change: adding new Graph API-mapped fields to the Post type model.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/post-missing-fields

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.

@nbartels nbartels added this to the 2026.6.0 milestone May 7, 2026
@nbartels nbartels self-assigned this May 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/test/java/com/restfb/types/PostTest.java`:
- Around line 281-303: Add a complementary negative test to cover
absence/malformed mappings: create a new test (e.g.,
checkMissingPostFields_absence) in PostTest that deserializes a JSON fixture
with those fields omitted/malformed (similar to
jsonFromClasspath("post-missing-fields") but without the optional keys), then
assert that optional object fields (examplePost.getBackdatedTime(),
examplePost.getCoordinates(), coordinates.getCoords()) are null, that optional
Boolean/primitive flags (examplePost.getIsFbLiveVideos(),
examplePost.getSubscribed()) are false or null as appropriate, and that
collections (coordinates.getTaggedUids()) are empty or null; use the same unique
symbols (examplePost, Post.Coordinates, getBackdatedTime, getIsFbLiveVideos,
getSubscribed, getCoordinates, getCoords, getTaggedUids) so the assertions
mirror the happy-path test but verify null/default handling for the
absence/failure path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b6433131-ac1e-4b7e-8d12-26c7fea37727

📥 Commits

Reviewing files that changed from the base of the PR and between 8ba2c73 and 157ac7f.

📒 Files selected for processing (3)
  • src/main/lombok/com/restfb/types/Post.java
  • src/test/java/com/restfb/types/PostTest.java
  • src/test/resources/json/post-missing-fields.json

Comment thread src/test/java/com/restfb/types/PostTest.java
@nbartels
nbartels merged commit cc56594 into dev May 7, 2026
4 checks passed
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.

1 participant