Conversation
- Update Mustache template to always flatten body params using dynamic
{{#vars}} iteration instead of hardcoded field names
- Remove x-sdk-flatten-body-fields vendor extension dependency
- Point inputSpec to https://app.reflag.com/openapi.json
- Fix generate script to use npx @openapitools/openapi-generator-cli
- Remove deprecated updateBulkFlagSpecificTargets endpoint
- Add createFlag/updateFlag support with flattened params
- Update README examples to match flattened API surface
… fields - Template uses `extends BodyType` instead of iterating body vars, fixing missing nested type imports (e.g. EntityFlagUpdate) - Update demo app for renamed API fields: value → specificTargetValue, specificallyTargetedValue → specificTargetValue - Remove debug console.log from api.ts
- Show "Yes"/"Yes (implicitly)"/"No" instead of checkboxes - Hide action button for inherited flags - Add revalidatePath to fix stale data after toggle - Remove redundant re-fetch in toggle actions
This reverts commit bccd7eb.
# Conflicts: # packages/browser-sdk/src/storage.ts # packages/browser-sdk/test/client.test.ts # packages/browser-sdk/test/storage.test.ts
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new (beta) @reflag/rest-api-sdk package generated from Reflag’s OpenAPI spec, plus a small Next.js example app demonstrating user/company flag toggling and documentation links from the repo root.
Changes:
- Introduces
@reflag/rest-api-sdkwith a typed OpenAPI-generated client and an app-scoped client wrapper (createAppClient). - Adds a Next.js example app (
customer-admin-panel) that consumes the SDK via server actions. - Updates monorepo workspaces and root README to include the new SDK and examples/dev apps.
Reviewed changes
Copilot reviewed 30 out of 72 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rest-api-sdk/tsconfig.json | TypeScript config for building the REST API SDK package. |
| packages/rest-api-sdk/tsconfig.eslint.json | ESLint TS project configuration for the SDK. |
| packages/rest-api-sdk/tsconfig.build.json | Build TS config (relaxes unused checks for generated code). |
| packages/rest-api-sdk/test/createAppClient.test.ts | Tests that app scoping is preserved after middleware chaining. |
| packages/rest-api-sdk/src/index.ts | Public entrypoint exports for SDK + generated surface. |
| packages/rest-api-sdk/src/generated/runtime.ts | OpenAPI generator runtime (BaseAPI, middleware, error classes). |
| packages/rest-api-sdk/src/generated/models/index.ts | Barrel export for generated models. |
| packages/rest-api-sdk/src/generated/models/UpdateFlagRequest.ts | Generated model for updating flags. |
| packages/rest-api-sdk/src/generated/models/UpdateEntityFlagsBody.ts | Generated model for entity flag updates request body. |
| packages/rest-api-sdk/src/generated/models/StageHeader.ts | Generated model for stage summary. |
| packages/rest-api-sdk/src/generated/models/SortOrder.ts | Generated sort order enum/type helpers. |
| packages/rest-api-sdk/src/generated/models/SegmentType.ts | Generated segment type enum/type helpers. |
| packages/rest-api-sdk/src/generated/models/SegmentHeader.ts | Generated model for segment summary. |
| packages/rest-api-sdk/src/generated/models/ReflagUserHeader.ts | Generated model for user summary. |
| packages/rest-api-sdk/src/generated/models/OrgHeader.ts | Generated model for org summary. |
| packages/rest-api-sdk/src/generated/models/FlagValueTargeting.ts | Generated model for flag value targeting audience. |
| packages/rest-api-sdk/src/generated/models/FlagValue.ts | Generated flag value enum/type helpers. |
| packages/rest-api-sdk/src/generated/models/FlagTargeting.ts | Generated model for flag targeting payload. |
| packages/rest-api-sdk/src/generated/models/FlagKeyFormat.ts | Generated enum/type for flag key format. |
| packages/rest-api-sdk/src/generated/models/FlagHeaderCollection.ts | Generated collection model for flag headers. |
| packages/rest-api-sdk/src/generated/models/FlagHeader.ts | Generated model for basic flag header. |
| packages/rest-api-sdk/src/generated/models/ErrorResponseError.ts | Generated model for error response error object. |
| packages/rest-api-sdk/src/generated/models/ErrorResponse.ts | Generated error response model. |
| packages/rest-api-sdk/src/generated/models/EnvironmentSdkAccess.ts | Generated model for environment SDK access keys. |
| packages/rest-api-sdk/src/generated/models/EnvironmentHeaderSortByColumn.ts | Generated enum/type for environment sorting. |
| packages/rest-api-sdk/src/generated/models/EnvironmentHeaderCollection.ts | Generated collection model for environment headers. |
| packages/rest-api-sdk/src/generated/models/EnvironmentHeader.ts | Generated model for environment header. |
| packages/rest-api-sdk/src/generated/models/Environment.ts | Generated model for environment details. |
| packages/rest-api-sdk/src/generated/models/EntityFlagsResponse.ts | Generated response model for evaluated entity flags. |
| packages/rest-api-sdk/src/generated/models/EntityFlagUpdate.ts | Generated model for per-flag targeting override update. |
| packages/rest-api-sdk/src/generated/models/EntityFlag.ts | Generated model for evaluated flag value + metadata. |
| packages/rest-api-sdk/src/generated/models/CreateFlagRequest.ts | Generated model for creating a flag. |
| packages/rest-api-sdk/src/generated/models/CreateFlag200ResponseFlag.ts | Generated model for createFlag response flag details. |
| packages/rest-api-sdk/src/generated/models/CreateFlag200Response.ts | Generated model for createFlag response wrapper. |
| packages/rest-api-sdk/src/generated/models/AppHeaderCollection.ts | Generated collection model for app headers. |
| packages/rest-api-sdk/src/generated/models/AppHeader.ts | Generated model for app header with environments. |
| packages/rest-api-sdk/src/generated/models/App.ts | Generated model for app details. |
| packages/rest-api-sdk/src/generated/index.ts | Generated top-level barrel export. |
| packages/rest-api-sdk/src/generated/apis/index.ts | Barrel export for generated APIs. |
| packages/rest-api-sdk/src/generated/apis/DefaultApi.ts | Generated API client implementation for REST endpoints. |
| packages/rest-api-sdk/src/generated/.openapi-generator/VERSION | Records OpenAPI generator version used. |
| packages/rest-api-sdk/src/generated/.openapi-generator/FILES | Records generated file list for regeneration tracking. |
| packages/rest-api-sdk/src/generated/.openapi-generator-ignore | OpenAPI generator ignore rules. |
| packages/rest-api-sdk/src/api.ts | SDK wrapper: error normalization + app-scoped Proxy client. |
| packages/rest-api-sdk/package.json | New package metadata and scripts (generate/build/test/lint). |
| packages/rest-api-sdk/openapitools.json | OpenAPI generator CLI config (version pin, schema). |
| packages/rest-api-sdk/openapi.json | Placeholder OpenAPI spec file (currently empty). |
| packages/rest-api-sdk/openapi-templates/apis.mustache | Custom OpenAPI generator template overrides for API typing. |
| packages/rest-api-sdk/openapi-generator.config.yaml | OpenAPI generator config (typescript-fetch, remote inputSpec). |
| packages/rest-api-sdk/examples/customer-admin-panel/tsconfig.json | Example app TS config (Next.js). |
| packages/rest-api-sdk/examples/customer-admin-panel/package.json | Example app package definition. |
| packages/rest-api-sdk/examples/customer-admin-panel/next.config.js | Example app Next.js config (transpile workspace SDK). |
| packages/rest-api-sdk/examples/customer-admin-panel/next-env.d.ts | Example app Next.js TypeScript env declarations. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/page.tsx | Example app home route. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/layout.tsx | Example app root layout and metadata. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/globals.css | Example app global styling. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/flags/user/page.tsx | Example route to view/toggle user flags via server actions. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/flags/page.tsx | Example flags landing page with navigation to entity pages. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/flags/company/page.tsx | Example route to view/toggle company flags via server actions. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/flags/actions.ts | Server actions using the REST SDK to query/update flags. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/flags/EntityFlagsFilterForm.tsx | Client form component for selecting app/env/entity ID. |
| packages/rest-api-sdk/examples/customer-admin-panel/app/flags/AppEnvForm.tsx | Client form component for selecting app/environment. |
| packages/rest-api-sdk/examples/customer-admin-panel/README.md | Example app setup/run instructions. |
| packages/rest-api-sdk/eslint.config.js | ESLint config for SDK package (ignores dist/generated/examples). |
| packages/rest-api-sdk/README.md | SDK documentation (usage, workflows, error handling, example link). |
| packages/rest-api-sdk/.prettierignore | Prettier ignore rules for dist and generated output. |
| packages/react-sdk/dev/nextjs-bootstrap-demo/app/client.ts | Adjusts dev demo offline behavior when secret key is missing. |
| package.json | Expands Yarn workspaces to include example/dev packages. |
| README.md | Adds a repo-level section linking to REST API SDK docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/rest-api-sdk/examples/customer-admin-panel/app/flags/actions.ts
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.