Skip to content

Conversation

jimmyjames
Copy link
Contributor

@jimmyjames jimmyjames commented Aug 19, 2025

Move the existing examples from the example directory to examples

Description

What problem is being solved?

We currently have two example applications (one java, one kotlin) in the example directory. As part of #117, we should also have an open telemetry example (like other SDKs). Having multiple examples in a directory named example is confusing.

How is it being solved?

Move existing java and kotlin examples to a new directory, examples/basic-examples.

What changes are made to solve it?

As little changes as possible to the actual example code has been changed. The purpose of the change is to move the existing code, not to address any issues with the current example.

That said, the build was failing due to some gradle compatibilty issues. This commit updates the gradle version and fixes spotless issues so that the example compiles and runs.

References

#117

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

Summary by CodeRabbit

  • New Features
    • Simplified running basic examples: build and run tasks now execute from the repository root.
  • Documentation
    • Removed outdated examples README.
  • Chores
    • Updated Gradle wrapper for examples to 8.2.1 (all distribution) for improved tooling support.
    • Adjusted dependency update configuration to monitor the new examples path.
  • Style
    • Minor code formatting and comment cleanup in example code; no behavioral changes.

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 35.19%. Comparing base (ecef92e) to head (d36d926).

❌ Your project status has failed because the head coverage (35.19%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #210   +/-   ##
=========================================
  Coverage     35.19%   35.19%           
  Complexity     1071     1071           
=========================================
  Files           187      187           
  Lines          7087     7087           
  Branches        803      803           
=========================================
  Hits           2494     2494           
  Misses         4483     4483           
  Partials        110      110           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

Walkthrough

Updated Dependabot Gradle path, removed an example README, adjusted Makefile targets to run from repo root, upgraded Gradle wrapper version, and reformatted comments/line breaks in a Java example without changing behavior.

Changes

Cohort / File(s) Summary
Dependabot config
.github/dependabot.yaml
Changed Gradle update directory from /example/example1 to /examples/basic-examples; other settings unchanged.
Example docs removal
example/README.md
Deleted the README detailing how to run SDK examples; no code affected.
Examples build tooling
examples/basic-examples/Makefile, examples/basic-examples/gradle/wrapper/gradle-wrapper.properties
Makefile now runs Gradle from repo root (project_name set to .; removed directory changes). Gradle wrapper upgraded from 8.0-bin to 8.2.1-all.
Java example formatting
examples/basic-examples/src/main/java/dev/openfga/sdk/example/Example1.java
Formatting-only edits: single-line method call and comment reflow; no behavioral changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/update-example

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jimmyjames jimmyjames marked this pull request as ready for review August 19, 2025 15:22
@jimmyjames jimmyjames requested review from a team as code owners August 19, 2025 15:22
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 (4)
examples/basic-examples/gradle/wrapper/gradle-wrapper.properties (1)

3-3: Use the “bin” distribution and pin the SHA-256 checksum

Switching from -all to -bin cuts down CI download size, and adding distributionSha256Sum hardens your supply chain.

• Update examples/basic-examples/gradle/wrapper/gradle-wrapper.properties:

- distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
+ distributionSha256Sum=<INSERT_SHA256_CHECKSUM_HERE>

• To generate the checksum, you can download the bin ZIP and run:

sha256sum gradle-8.2.1-bin.zip | awk '{ print $1 }'

• Verify the wrapper config:

rg -n '^distributionUrl=' examples/basic-examples/gradle/wrapper/gradle-wrapper.properties
rg -nP '^distributionSha256Sum\s*=' examples/basic-examples/gradle/wrapper/gradle-wrapper.properties
.github/dependabot.yaml (1)

15-15: Dependabot Gradle directory check

Verified that examples/basic-examples contains:

  • build.gradle
  • gradlew
  • gradle/wrapper/gradle-wrapper.properties

However, gradle/wrapper/gradle-wrapper.jar is not present. Dependabot will fall back to a system Gradle or attempt to download the wrapper JAR at runtime, which can be fragile. Please commit the wrapper JAR into gradle/wrapper/gradle-wrapper.jar (or confirm your CI environment has a compatible Gradle installation) to ensure Dependabot can reliably resolve and update dependencies.

If you add more example projects in the future, remember to add each new path under the directories section in .github/dependabot.yaml.

examples/basic-examples/Makefile (1)

3-11: Remove unused variable; consider minor Makefile hygiene.

  • project_name=. is no longer used; remove it.
  • Optional: mark targets as .PHONY and consider --no-daemon for CI consistency.

Apply this diff to drop the unused variable:

-project_name=.

If you want the hygiene improvements (outside the changed lines), you can add:

.PHONY: all build run run-openfga

And optionally:

-	./gradlew -P language=$(language) build
+	./gradlew --no-daemon -P language=$(language) build
-	./gradlew -P language=$(language) run
+	./gradlew --no-daemon -P language=$(language) run
examples/basic-examples/src/main/java/dev/openfga/sdk/example/Example1.java (1)

116-118: Reflow split comment for readability.

The end-of-line comment was split across lines; keep it on one line to avoid a dangling comment.

-                                                ._object("document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a") // different
-                                        // relation
+                                                ._object("document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a") // different relation
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ecef92e and d36d926.

⛔ Files ignored due to path filters (1)
  • example/example1/gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
📒 Files selected for processing (5)
  • .github/dependabot.yaml (1 hunks)
  • example/README.md (0 hunks)
  • examples/basic-examples/Makefile (1 hunks)
  • examples/basic-examples/gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • examples/basic-examples/src/main/java/dev/openfga/sdk/example/Example1.java (2 hunks)
💤 Files with no reviewable changes (1)
  • example/README.md
🔇 Additional comments (1)
examples/basic-examples/src/main/java/dev/openfga/sdk/example/Example1.java (1)

31-31: LGTM on the formatting tweak.

Inline call to authorizationModelId(System.getenv("FGA_MODEL_ID")) reads cleaner and doesn’t alter behavior.

@jimmyjames jimmyjames added this pull request to the merge queue Aug 19, 2025
Merged via the queue into main with commit c70b4d6 Aug 19, 2025
25 checks passed
@jimmyjames jimmyjames deleted the chore/update-example branch August 19, 2025 15:44
@coderabbitai coderabbitai bot mentioned this pull request Oct 7, 2025
4 tasks
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.

3 participants