Skip to content

Conversation

@daniel-jonathan
Copy link
Contributor

@daniel-jonathan daniel-jonathan commented Nov 19, 2025

Add supportsStreamedListObjects Config Flag Support for JS SDK

Problem

The JS SDK generator always builds with streaming support enabled, ignoring any potential configuration flag. This is inconsistent with the dotnet SDK approach and provides no flexibility to disable streaming during development.

The Makefile unconditionally calls build-client-streamed for JS SDK:

.PHONY: build-client-js
build-client-js:
	make build-client-streamed sdk_language=js tmpdir=${TMP_DIR}

Solution

Apply the same conditional streaming support pattern implemented for dotnet SDK to the JS SDK.

Changes

1. config/clients/js/config.overrides.json

Added supportsStreamedListObjects flag:

{
  ...
  "enumNameSuffix": "",
  "supportsStreamedListObjects": false,
  "files": {
    ...
  }
}

Default: false (streaming disabled until implementation is merged)

2. Makefile

Updated build-client-js to conditionally build based on flag:

.PHONY: build-client-js
build-client-js:
	@if grep -q '"supportsStreamedListObjects": true' config/clients/js/config.overrides.json; then \
		echo "Building JS SDK with streaming support..."; \
		make build-client-streamed sdk_language=js tmpdir=${TMP_DIR}; \
	else \
		echo "Building JS SDK without streaming support..."; \
		make build-client-non-streamed sdk_language=js tmpdir=${TMP_DIR}; \
	fi
	sed -i -e "s|_this|this|g" ${CLIENTS_OUTPUT_DIR}/fga-js-sdk/*.ts
	sed -i -e "s|_this|this|g" ${CLIENTS_OUTPUT_DIR}/fga-js-sdk/*.md

Result

The flag now works correctly for JS SDK:

With flag = false (current default):

$ make build-client-js
Building JS SDK without streaming support...
# Streaming endpoint removed from generated SDK

With flag = true (when streaming is ready):

$ make build-client-js
Building JS SDK with streaming support...
# Streaming endpoint included in generated SDK

Cross-SDK Consistency

SDK Has Flag Conditional Build Default
Dotnet Yes Yes false
JS Yes Yes false
Python Yes (method name) N/A Enabled

Both dotnet and JS now follow the same pattern for streaming support configuration.

Testing

Verified that:

  • JS SDK builds successfully with flag = true
  • Conditional logic correctly routes to streamed/non-streamed build targets
  • Matches dotnet SDK behavior

Impact

This change:

  • Provides consistency across SDK generators
  • Allows independent control of streaming support per SDK
  • Enables cleaner development workflow (can disable streaming until ready)
  • Follows the established pattern from dotnet SDK

Files Modified

  • Makefile
  • config/clients/js/config.overrides.json

Related PRs

Summary by CodeRabbit

  • Chores

    • Build process updated to conditionally select between client implementation variants at build time based on configuration settings.
  • New Features

    • Added new configuration property to control streaming support for the JavaScript client.

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

Apply the same conditional streaming support to JS SDK that was
implemented for dotnet SDK.

Changes:
- Add supportsStreamedListObjects flag to JS config (default: false)
- Update build-client-js to conditionally use streamed/non-streamed build
- Matches dotnet SDK pattern for consistency

Both dotnet and JS SDKs now respect the supportsStreamedListObjects flag:
- When true: generates streaming endpoint
- When false: removes streaming endpoint from spec

This provides flexibility to enable/disable streaming per SDK
independently during development.

Default is false until streaming implementation is merged.
@daniel-jonathan daniel-jonathan requested a review from a team as a code owner November 19, 2025 22:54
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

The JavaScript SDK build process now includes runtime configuration-based selection between streaming and non-streaming client implementations. A new supportsStreamedListObjects flag (set to false) is introduced in the configuration, and the Makefile conditionally selects the appropriate build target based on this flag's value.

Changes

Cohort / File(s) Summary
Build Configuration
Makefile
Modified build-client-js target to inspect config/clients/js/config.overrides.json for supportsStreamedListObjects flag and conditionally execute build-client-streamed or build-client-non-streamed target accordingly
Client Configuration
config/clients/js/config.overrides.json
Added new boolean property supportsStreamedListObjects set to false at root level

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The conditional logic in the Makefile is straightforward and follows a simple if-then-else pattern based on a JSON property check
  • Configuration change is minimal and non-breaking (new flag with default value)

Possibly related PRs

Suggested reviewers

  • rhamzeh
  • SoulPancake

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 clearly and specifically describes the main change: adding a new configuration flag 'supportsStreamedListObjects' to the JS SDK generator.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/js-streaming-flag-support

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c3efea and 7fac64b.

📒 Files selected for processing (2)
  • Makefile (1 hunks)
  • config/clients/js/config.overrides.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
Makefile

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Makefile: Update OPEN_API_REF in the Makefile when targeting new OpenFGA API versions
Update Docker image tags in the Makefile when upgrading build tools
Use official, tagged Docker images for containerized builds

Files:

  • Makefile
config/clients/*/config.overrides.json

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

config/clients/*/config.overrides.json: Always update the packageVersion in each language-specific config.overrides.json when making version changes
Maintain FOSSA compliance notice IDs in each language’s config.overrides.json

Files:

  • config/clients/js/config.overrides.json
config/**/*.{json,mustache}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Never hardcode API keys or credentials in configuration or template files

Files:

  • config/clients/js/config.overrides.json
config/{common/config.base.json,clients/*/config.overrides.json}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Ensure consistent versioning across base and language override configuration files to avoid version conflicts

Files:

  • config/clients/js/config.overrides.json
🧠 Learnings (5)
📚 Learning: 2025-09-04T17:35:34.111Z
Learnt from: CR
Repo: openfga/sdk-generator PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-04T17:35:34.111Z
Learning: Applies to scripts/build_client.sh : Implement and maintain OpenAPI transformations in scripts/build_client.sh (remove streaming endpoints, rename Object to FgaObject, strip v1. prefixes) when API schemas change

Applied to files:

  • Makefile
📚 Learning: 2025-09-04T17:35:34.111Z
Learnt from: CR
Repo: openfga/sdk-generator PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-04T17:35:34.111Z
Learning: Applies to scripts/build_client.sh : Clean up temporary directories and containers during/after builds to manage resources efficiently

Applied to files:

  • Makefile
📚 Learning: 2025-09-04T17:35:34.111Z
Learnt from: CR
Repo: openfga/sdk-generator PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-04T17:35:34.111Z
Learning: Applies to config/clients/*/config.overrides.json : Maintain FOSSA compliance notice IDs in each language’s config.overrides.json

Applied to files:

  • config/clients/js/config.overrides.json
📚 Learning: 2025-09-04T17:35:34.111Z
Learnt from: CR
Repo: openfga/sdk-generator PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-04T17:35:34.111Z
Learning: Applies to config/{common/config.base.json,clients/*/config.overrides.json} : Ensure consistent versioning across base and language override configuration files to avoid version conflicts

Applied to files:

  • config/clients/js/config.overrides.json
📚 Learning: 2025-09-04T17:35:34.111Z
Learnt from: CR
Repo: openfga/sdk-generator PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-04T17:35:34.111Z
Learning: Applies to config/clients/*/config.overrides.json : Always update the packageVersion in each language-specific config.overrides.json when making version changes

Applied to files:

  • config/clients/js/config.overrides.json
⏰ 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). (3)
  • GitHub Check: build-and-test-java-sdk
  • GitHub Check: build-and-test-dotnet-sdk
  • GitHub Check: build-and-test-go-sdk
🔇 Additional comments (2)
config/clients/js/config.overrides.json (1)

15-15: Configuration flag addition approved.

The new supportsStreamedListObjects: false flag correctly sets the default to non-streaming, aligning with PR objectives. FOSSA compliance notice ID is preserved, and no packageVersion update is required since this is a feature flag, not a version change.

Makefile (1)

71-77: Conditional build logic correctly implements streaming flag support.

The shell conditional properly reads the configuration flag and routes to the appropriate build target. The pattern mirrors the dotnet implementation (lines 116–122), ensuring architectural consistency. Both build targets (build-client-streamed and build-client-non-streamed) are invoked with correct parameters, and post-build sed operations remain unaffected by the conditional path.


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.

@daniel-jonathan daniel-jonathan added this pull request to the merge queue Nov 20, 2025
Merged via the queue into main with commit e453358 Nov 20, 2025
13 of 15 checks passed
@daniel-jonathan daniel-jonathan deleted the feat/js-streaming-flag-support branch November 20, 2025 00:05
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