`feature create --variants` ignores each variant's `key`
Los mantenedores suelen responder en 2 días
@Anuragkumar-687 ya está trabajando en esto.
Desde el 28/11/2026.
- #127 de @Anuragkumar-687 — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
Línea de trabajo
Comienza en internal/cmd/feature.go y examina variantInput y variantsForWrite; luego, compara su procesamiento con feature variant add --key. La tarea está completa cuando el JSON de --variants conserva el key de cada variante al crearla y la ayuda de --variants enumera los campos aceptados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
variantInput in internal/cmd/feature.go only has value and weight, so a key in the --variants JSON is silently dropped (json.Unmarshal ignores unknown fields).
The key matters for Experimentation: exposures are recorded under the variant's key, so a variant without one can't be told apart in an experiment's results. And setting the key afterwards with feature variant update --key fails (https://github.com/Flagsmith/flagsmith-cli/issues/125).
Steps to reproduce (CLI v2.0.0, self-hosted Flagsmith 2.295.2)
flagsmith feature create pricing_layout --value monthly_first --enabled \
--variants '[{"key":"annual_first","value":"annual_first","weight":50}]'
flagsmith feature get pricing_layout --json --jq .variants
# [{"id":2,"value":"annual_first","weight":50}] <- no key
Expected: the variant keeps "key": "annual_first", the way feature variant add --key does.
Suggested fix: add Key string `json:"key"` to variantInput, and set it on the MultivariateOption in variantsForWrite. It could help to list the accepted fields in the --variants help too.
Workaround: create the feature first, then add each variant with flagsmith feature variant add <feature> --value … --key … --weight ….
- Lenguaje dominante
- Go
- Estrellas
- 14
- Forks
- 4
- Merge medio
- 3 d 7 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Flagsmith/flagsmith-cli
-
`flagsmith login` fails on a self-hosted instance that isn't served at `http://localhost:8000`Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Flagsmith/flagsmith-cli#128 ·
Los mantenedores suelen responder en 2 días
-
`feature variant update` fails with a 500: the API needs `feature` and `default_percentage_allocation` in the PATCHPosiblemente ocupada @Anuragkumar-687 la tomó hoy. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 45/100
Flagsmith/flagsmith-cli#125 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Flagsmith/flagsmith-cli#107 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Flagsmith/flagsmith-cli#93 ·
Los mantenedores suelen responder en 2 días
-
Dependency DashboardAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Flagsmith/flagsmith-cli#90 ·
Los mantenedores suelen responder en 2 días
Todos los issues de Flagsmith/flagsmith-cli
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
expr-lang/expr#1037 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Provider Key: Sauberr/neckrezAbiertoprovider-key submission
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
opentofu/registry#6740 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
nightgauge/nightgauge#3713 ·
Los mantenedores suelen responder en 1 día
-
fix: restore GitHub issue templates and check their license headersPosiblemente ocupada @slievrly la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días