Should enum inputs be case-insensitive?
- Dominant language
- TypeScript
- Stars
- 64
- Forks
- 20
- Avg merge
- 15h 37m
- Merged PRs (30d)
- 4
Description
We have various action inputs that take a fixed set of values, or a list of a fixed set of values.
Some examples:
`type` - must be either `deployment` or `deploymentStacks`
`scope` - must be either `tenant`, `managementGroup`, `subscription` or `resourceGroup`
Currently our validation logic is strict - the casing has to match exactly. This means that we would reject `scope: Tenant` or `type: deploymentstacks`.
As raised in https://github.com/Azure/bicep-deploy/pull/85#discussion_r1906865668, this is a bit odd with our `environment` input, as it requires camel case (`azureCloud`, `azureChinaCloud`, `azureGermanCloud`, `azureUSGovernment`), whereas the `environment` input for the "azure-login" action (which this is commonly used with) requires Pascal Case (`AzureCloud`, `AzureChinaCloud`, `AzureGermanCloud`, `AzureUSGovernment`) - see https://github.com/marketplace/actions/azure-login#environment
IMO the best option for dealing with this inconsistency would be to relax our validation such that we don't care about casing for enum inputs.
Contributor guide
Research direction
Start by locating the validation logic for action inputs and the enum definitions for type, scope, and environment. Review any existing validation tests, then verify that accepted values with different casing behave consistently while invalid values remain rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, github-actions, typescript
- Domain
- ci-cd, devops
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100