> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit Flag Schema

> Learn how to add or change properties in a flag's schema.

export const HowToSchema = ({name, description, steps = []}) => {
  const schema = {
    "@context": "https://schema.org",
    "@type": "HowTo",
    name,
    description
  };
  if (steps.length > 0) {
    schema.step = steps.map((s, i) => ({
      "@type": "HowToStep",
      position: i + 1,
      name: typeof s === "string" ? s : s.name,
      text: typeof s === "string" ? s : s.text || s.name
    }));
  }
  return <script type="application/ld+json" dangerouslySetInnerHTML={{
    __html: JSON.stringify(schema)
  }} />;
};

<HowToSchema
  name="Edit Flag Schema"
  description="Learn how to add or change properties in a flag's schema."
  steps={[
"Go to Confidence",
"On the left sidebar, select Flags",
"Go to the flag you want to edit the schema for",
{
  name: "Click the edit schema button",
  text: "Click the edit schema button (pencil icon) next to the Variants heading on the flag detail page.",
},
{
  name: "Click Add property and select a type",
  text: "Click Add property and select the property type from the menu: string, bool, int, double, or struct.",
},
{
  name: "Enter the property name",
  text: "Give the new property a descriptive name.",
},
{
  name: "Click Save",
  text: "Click Save to apply your changes to the schema.",
},
]}
/>

The [flag schema](../flags/create-flags#flag-schema) defines the available properties and their data types for a flag.

## Edit Schema

Boolean flags start with a single `enabled` property of Boolean type. JSON flags start with the properties you defined during creation. You can add more properties to any flag type.

You can always add new properties to a flag's schema.

<Tip>
  Program your clients so that they can always handle the presence of new
  properties in flag value.
</Tip>

You can change the name of a property if no variant sets a value for that
particular property. The same is true for deleting a property from the schema.
You can only delete a property if no variant sets a value for it. The schema editor disables properties that are in use by variants.

To edit the schema for a flag, follow these steps.

<Steps>
  <Step title="Go to Confidence" />

  <Step title="On the left sidebar, select Flags" />

  <Step title="Go to the flag you want to edit the schema for" />

  <Step title="Click the edit schema button">
    Click the edit schema button (pencil icon) next to the **Variants** heading on the flag detail page.
  </Step>

  <Step title="Click Add property and select a type">
    Click **Add property** and select the property type from the menu: string, bool, int, double, or struct.
  </Step>

  <Step title="Enter the property name">
    Give the new property a descriptive name.
  </Step>

  <Step title="Click Save">
    Click **Save** to apply your changes to the schema.
  </Step>
</Steps>

<Tip>
  * Use short and descriptive name of the properties. For example, `color` is great.
  * Use boolean properties to represent the state of a feature. For example, use
    `enable` to represent if you should enable a feature or not.
  * Use kebab-case for property names: `result-count` is better than `resultCount`.
  * Avoid putting too much information in the name. For example, `color` is better
    than `bgColor`.
</Tip>

## Related Resources

<CardGroup cols={2}>
  <Card title="Create Variants" href="/docs/how-to-guides/create-flag-variant">
    Add variants with values for your schema properties
  </Card>

  <Card title="Create a Flag" href="/docs/how-to-guides/create-flag">
    Set up a new feature flag
  </Card>

  <Card title="Flags Reference" href="/docs/flags/create-flags">
    Learn about flag schemas and configuration
  </Card>

  <Card title="Define Flag Schema API" href="/docs/api/how-to-guides/flags/define-flag-schema">
    API reference for schemas
  </Card>
</CardGroup>
