Repository: hashicorp/vault
File: ui/lib/core/addon/components/form-field.js (JavaScript)

Code before:
        if (
          options?.editType === undefined ||
          options?.editType === 'password' ||
          options?.editType === 'textarea' ||
          options?.editType === 'string' ||
          options?.editType === 'number'
        ) {
          return true;
        } else {
          return false;
        }
      } else if (type === 'boolean' || options?.editType === 'boolean') {
        return true;
      } else {
        // we leave these fields as they are (for now)
        return false;
      }
    }
  }

  get hasRadioSubText() {
    // for 'radio' editType, check to see if any of the possibleValues has a subText
    return this.args?.attr?.options?.possibleValues?.any((v) => v.subText);
  }

  get hasRadioHelpText() {
    // for 'radio' editType, check to see if any of the possibleValues has a helpText
    return this.args?.attr?.options?.possibleValues?.any((v) => v.helpText);
  }

  get hideLabel() {
    const { type, options } = this.args.attr;
    if (type === 'object' || options?.isSectionHeader) {
      return true;
    }
    // falsey values render a <FormFieldLabel>
    return this.shouldHideLabel.includes(options?.editType);
  }

  get disabled() {
    return this.args.disabled || false;
  }

  get helpTextString() {
    const helpText = this.args.attr?.options?.helpText;
    if (this.args.showHelpText !== false && helpText) {
      return helpText;
    }
    return '';
  }


Review comment (bug):
[Note] In the API comments at the top of this file `editType` has no listed values of `string` and `number`. The original logic in the template is based around the regular text input being used when `editType=undefined`. Most form inputs follow this logic, and do not set an `editType` when using the regular text input.

However, it seems there are some cases where `editType` of `string` and `number` are being set. There were test failures caused without introducing this catch for these values here. There are also a few instances in the test suite of `editType='string'` and `editType='number'`. 

Code after:
    // to make sure we don't change the order in which the "ifs" are evaluated
    // see: https://github.com/hashicorp/vault/blob/e99c06a0249f1ecde02c5b48990cb0e91e4ec575/ui/lib/core/addon/components/form-field.hbs
    if (options?.possibleValues?.length > 0) {
      return true;
    } else {
      if (options?.editType === 'dateTimeLocal') {
        return true;
      } else if (
        options?.editType === 'searchSelect' ||
        options?.editType === 'mountAccessor' ||
        options?.editType === 'kv' ||
        options?.editType === 'file' ||
        options?.editType === 'ttl' ||
        options?.editType === 'regex' ||
        options?.editType === 'toggleButton' ||
        options?.editType === 'optionalText' ||
        options?.editType === 'stringArray' ||
        options?.sensitive === true
      ) {
        return false;
      } else if (type === 'number' || type === 'string') {
        if (options?.editType === 'textarea' || options?.editType === 'password') {
          return true;
        } else if (options?.editType === 'json') {
          return false;
        } else {
          return true;
        }
      } else if (type === 'boolean' || options?.editType === 'boolean') {
        return true;
      } else if (type === 'object' || options?.editType === 'yield') {
        return false;
      } else {
        // fallback, just in case
        return false;
      }
    }
  }

  get hasRadioSubText() {
    // for 'radio' editType, check to see if any of the possibleValues has a subText
    return this.args?.attr?.options?.possibleValues?.any((v) => v.subText);
  }

  get hasRadioHelpText() {
    // for 'radio' editType, check to see if any of the possibleValues has a helpText
    return this.args?.attr?.options?.possibleValues?.any((v) => v.helpText);
  }

  get hideLabel() {
    const { type, options } = this.args.attr;