Skip to content

Commit

Permalink
Allow uppercase letters in feature keys (#2491)
Browse files Browse the repository at this point in the history
* Allow uppercase letters in feature keys

* Fix extra word in docs
  • Loading branch information
jdorn committed May 10, 2024
1 parent c1fc9bc commit a2a7d19
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 234 deletions.
230 changes: 0 additions & 230 deletions docs/docs/features-old.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions docs/docs/features/basics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ If you make a mistake, you can always delete the feature and create a new one.

<img src="/images/features/feature-create-feature-1.png" alt="Create Feature" width="600" />

Feature keys must be all lowercase and include only letters, numbers, hyphens, and underscores.
Feature keys must only include letters, numbers, hyphens, and underscores.

Some examples of good feature keys:

- `onboarding-checklist` - ON/OFF flag for a feature
- `checkout_button_color` - The color of the checkout button
- `results-per-page` - Number of search results to show per page
- `resultsPerPage` - Number of search results to show per page

## Default Values

Expand Down
2 changes: 1 addition & 1 deletion packages/back-end/src/api/features/postFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const postFeature = createApiRequestHandler(postFeatureValidator)(
dateCreated: new Date(),
dateUpdated: new Date(),
organization: req.organization.id,
id: req.body.id.toLowerCase(),
id: req.body.id,
archived: !!req.body.archived,
version: 1,
environmentSettings: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/back-end/src/controllers/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export async function postFeatures(
dateCreated: new Date(),
dateUpdated: new Date(),
organization: org.id,
id: id.toLowerCase(),
id,
archived: false,
version: 1,
hasDrafts: false,
Expand Down

1 comment on commit a2a7d19

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for docs ready!

✅ Preview
https://docs-7j4jiz3so-growthbook.vercel.app

Built with commit a2a7d19.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.