Skip to content

chore(go): use API executor for calling the API#660

Merged
SoulPancake merged 3 commits intomainfrom
feat/go-expose-api-executor
Dec 12, 2025
Merged

chore(go): use API executor for calling the API#660
SoulPancake merged 3 commits intomainfrom
feat/go-expose-api-executor

Conversation

@rhamzeh
Copy link
Member

@rhamzeh rhamzeh commented Nov 19, 2025

Description

What problem is being solved?

How is it being solved?

What changes are made to solve it?

References

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

  • Refactor
    • Simplified internal structure of generated Go client code with unified parameter validation and error handling.
    • Adopted a cleaner executor pattern in generated clients for improved maintainability and consistency.

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

Copilot AI review requested due to automatic review settings November 19, 2025 15:52
@rhamzeh rhamzeh requested a review from a team as a code owner November 19, 2025 15:52
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The Go API template is refactored to replace manual parameter handling, request component construction, and telemetry logic with a simplified executor-based pattern. Parameter validation is added upfront, and request building and execution are unified through an executor builder approach.

Changes

Cohort / File(s) Summary
Go API template refactoring
config/clients/go/template/api.mustache
Operation execution flow replaced with executor-based approach; adds parameter validation via validatePathParameter and validateParameter; removes manual header/query/body construction in favor of NewAPIExecutorRequestBuilder; simplifies error handling and response decoding

Sequence Diagram

sequenceDiagram
    participant Client as Client Code
    participant Template as Generated Operation
    participant Validator as Parameter Validator
    participant Executor as APIExecutor
    participant API as Remote API

    Client->>Template: Call Operation(params)
    
    rect rgb(240, 248, 255)
        Note over Template,Validator: Parameter Validation Phase
        Template->>Validator: validatePathParameter()
        Validator-->>Template: error or nil
        Template->>Validator: validateParameter()
        Validator-->>Template: error or nil
    end
    
    alt Validation Fails
        Template-->>Client: Return early with error
    else Validation Passes
        rect rgb(245, 255, 250)
            Note over Template,Executor: Request Building & Execution
            Template->>Executor: NewAPIExecutorRequestBuilder()
            Executor-->>Template: builder
            Template->>Executor: ExecuteWithDecode() or Execute()
        end
        
        Executor->>API: Send HTTP Request
        API-->>Executor: Response
        Executor-->>Template: Decoded result or error
    end
    
    Template-->>Client: Return result/error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Focus on validating the executor builder pattern integration and ensuring parameter validation covers all edge cases
  • Confirm error handling paths are complete and that no telemetry/retry logic was inadvertently lost
  • Verify backward compatibility in generated code structure and client behavior

Suggested reviewers

  • ttrzeng

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: refactoring the Go client template to use an API executor pattern instead of manual request handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

@rhamzeh rhamzeh force-pushed the feat/go-expose-api-executor branch from bb07d62 to a48dfc4 Compare November 19, 2025 15:53
@rhamzeh rhamzeh marked this pull request as draft November 19, 2025 15:53
@rhamzeh rhamzeh changed the title chore: tiny cleanup chore(go): use API executor for calling the API Nov 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR performs cleanup by removing README generation from the base configuration and refactoring the Go SDK API template to use a centralized API executor pattern. The JS-specific OPEN_API_REF environment variable override is also removed from the GitHub workflow.

  • Removes README.mustache from generated files in base config (file still exists in config/common/files/)
  • Removes JS-specific OPEN_API_REF environment variable from test workflow
  • Refactors Go API template to delegate HTTP execution to a centralized APIExecutor

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
config/common/config.base.json Removes README.mustache file mapping from base configuration
.github/workflows/main.yaml Removes OPEN_API_REF environment variable override for JS SDK tests
config/clients/go/template/api.mustache Major refactoring to use APIExecutor pattern instead of inline HTTP handling

@rhamzeh rhamzeh force-pushed the feat/go-expose-api-executor branch from a48dfc4 to 28b6b61 Compare November 19, 2025 21:29
@rhamzeh rhamzeh force-pushed the feat/go-expose-api-executor branch from 28b6b61 to 7ef8929 Compare November 19, 2025 21:48
@rhamzeh rhamzeh marked this pull request as ready for review November 20, 2025 01:42
@SoulPancake
Copy link
Member

@rhamzeh
Currently in this PR the readme is still generated from the template
Do we want to exclude those as you have mentioned in the description?

Remove Readme from being generated

@rhamzeh
Copy link
Member Author

rhamzeh commented Dec 10, 2025

Currently in this PR the readme is still generated from the template

We moved those two to another PR (yours! :P) to get them merged faster.

I'll remove them from the description here as they no longer apply

@SoulPancake SoulPancake added this pull request to the merge queue Dec 12, 2025
Merged via the queue into main with commit 3c0e188 Dec 12, 2025
15 checks passed
@SoulPancake SoulPancake deleted the feat/go-expose-api-executor branch December 12, 2025 06:30
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