Skip to content

fix(viewer): add missing parenthesis in Python SDK code rendering #1018

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

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

maxloge
Copy link
Contributor

@maxloge maxloge commented Apr 28, 2025

Description

This fixes a bug in BatchCheckRequestViewer.tsx where the Python SDK code generator was emitting ClientBatchCheckItem calls without a closing parenthesis, resulting in invalid Python examples on the site. Each ClientBatchCheckItem(...) is now properly closed with ) and items are separated with commas, producing valid Python syntax.

# current rendering
checks = [
  ClientBatchCheckItem(
    user="user:anne",
    relation="writer",
    object="document:Z",
    correlation_id="886224f6-04ae-4b13-bd8e-559c7d3754e1",
  ClientBatchCheckItem(
    user="user:anne",
    relation="reader",
    object="document:Z",
    correlation_id="da452239-a4e0-4791-b5d1-fb3d451ac078"
]

# updated rendering
checks = [
  ClientBatchCheckItem(
    user="user:anne",
    relation="writer",
    object="document:Z",
    correlation_id="886224f6-04ae-4b13-bd8e-559c7d3754e1"
  ),
  ClientBatchCheckItem(
    user="user:anne",
    relation="reader",
    object="document:Z",
    correlation_id="da452239-a4e0-4791-b5d1-fb3d451ac078"
  )
]

Also, Prettier was run on the file and updated lines 234 and 235.

References

The bug appears in these pages:

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

@maxloge maxloge requested review from a team as code owners April 28, 2025 02:03
Copy link

linux-foundation-easycla bot commented Apr 28, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

@maxloge maxloge marked this pull request as draft April 28, 2025 02:07
@maxloge maxloge force-pushed the fix/python-sdk-missing-parenthesis branch from 708e66f to 570edc1 Compare April 28, 2025 02:08
@maxloge maxloge marked this pull request as ready for review April 28, 2025 02:17
@rhamzeh
Copy link
Member

rhamzeh commented Apr 28, 2025

Thanks @maxloge !

@rhamzeh rhamzeh merged commit d2af258 into openfga:main Apr 28, 2025
9 of 11 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.

2 participants