Repository: hashicorp/vault
File: ui/app/models/totp-key.js (JavaScript)

Code before:
    possibleValues: ALGORITHMS,
    defaultValue: 'SHA1',
  })
  algorithm;

  @attr('number', {
    possibleValues: DIGITS,
    defaultValue: 6,
  })
  digits;

  @attr('string', {
    subText: `The name of the key's issuing organization.`,
  })
  issuer;

  @attr({
    label: 'Period',
    editType: 'ttl',
    helperTextEnabled: 'How long each generated TOTP is valid.',
    defaultValue: 30, // API accepts both an integer as seconds and string with unit e.g 30 || '30s'
  })
  period;

  // The generate attr is a boolean. The generateString getter and setter is used only in forms to get and set the boolean via
  // strings values. The server and query params expects the attr to be boolean values.
  @attr({
    label: 'Key Provider',
    defaultValue: true,
    editType: 'radio',
    possibleValues: ['Vault', 'Other service'],
    fieldValue: 'generateString',
    subText: `Specifies if the key should be generated by Vault or passed from another service.`,
  })
  generate;

  // Used when generate is true
  @attr('number', {
    defaultValue: 20,
  })
  key_size;

  @attr('number', {
    possibleValues: SKEW,
    defaultValue: 1,
  })
  skew;

  @attr('boolean', {
    editType: 'toggle',
    defaultValue: true,

Review comment (suggestion):
Elegant solution here ✨ !

Usually this is something we'd do in the serializer (which is where data transformations happen). Another way to do this is making possible values an object (which Formfield is setup to accept), that way the value could be the boolean. However, serialization would still be required to change it from a string "true" to the actual boolean.

But I think this is okay here. By "query params" do you mean params sent in the payload? If so, I would adjust the comment to clarify. "query params" in this context makes me think this is updating the URL somehow. 

Code after:
  @attr('number', {
    possibleValues: [6, 8],
    defaultValue: 6,
  })
  digits;

  @attr('string', {
    subText: `The name of the key's issuing organization. Required for keys generated by Vault.`,
  })
  issuer;

  @attr({
    editType: 'ttl',
    helperTextEnabled: 'How long each generated TOTP is valid.',
    defaultValue: 30, // API accepts both an integer as seconds and string with unit e.g 30 || '30s'
  })
  period;

  // The generate attr is a boolean. The generateString getter and setter is used only in forms to get and set the boolean via
  // strings values. The payload params expect the attr to be a boolean value.
  @attr({
    label: 'Key Provider',
    defaultValue: true,
    editType: 'radio',
    possibleValues: ['Vault', 'Other service'],
    fieldValue: 'generateString',
    subText: 'Specifies if the key should be generated by Vault or passed from another service.',
  })
  generate;

  // Used when generate is true
  @attr('number', {
    defaultValue: 20,
  })
  keySize;

  @attr('number', {
    possibleValues: [0, 1],
    defaultValue: 1,
  })
  skew;

  @attr('boolean', {
    editType: 'toggleButton',
    defaultValue: true,
    helperTextDisabled: 'Vault will not return QR code and url upon key creation.',
    helperTextEnabled: 'QR code and URL will be returned upon generating a key.',
  })
  exported;

  @attr('number', {