Repository: napi-rs/napi-rs
File: crates/macro/src/parser/mod.rs (Rust)

Code before:
      _ => bail_span!(self, "only public enum allowed"),
    }

    let js_name = opts
      .js_name()
      .map_or_else(|| self.ident.to_string(), |(s, _)| s.to_string());
    let is_string_enum = opts.string_enum().is_some();

    if self
      .variants
      .iter()
      .any(|v| !matches!(v.fields, syn::Fields::Unit))
    {
      let discriminant = opts.discriminant().map_or("type", |(s, _)| s);
      let discriminant_case = opts.discriminant_case().map(|c|
        Ok::<Case, Diagnostic>(match c.0 {
          "lowercase" => Case::Flat,
          "UPPERCASE" => Case::UpperFlat,
          "PascalCase" => Case::Pascal,
          "camelCase" => Case::Camel,
          "snake_case" => Case::Snake,
          "SCREAMING_SNAKE_CASE" => Case::UpperSnake,
          "kebab-case" => Case::Kebab,
          "SCREAMING-KEBAB-CASE" => Case::UpperKebab,
          _ => {
            bail_span!(self, "Unknown discriminant case. Possible values are \"lowercase\", \"UPPERCASE\", \"PascalCase\", \"camelCase\", \"snake_case\", \"SCREAMING_SNAKE_CASE\", \"kebab-case\", or \"SCREAMING-KEBAB-CASE\"")
          }
        })
      ).transpose()?;

      let mut errors = vec![];
      let mut variants = vec![];
      for variant in self.variants.iter_mut() {
        let (fields, is_tuple) = convert_fields(&mut variant.fields, false)?;
        for field in fields.iter() {
          if field.js_name == discriminant {
            errors.push(err_span!(
              field.name,
              r#"field's js_name("{}") and discriminator("{}") conflict"#,
              field.js_name,
              discriminant,
            ));
          }
        }
        variants.push(NapiStructuredEnumVariant {
          name: variant.ident.clone(),
          fields,
          is_tuple,
        });
      }
      let rust_struct_ident = self.ident.clone();

Review comment (suggestion):
```suggestion
            bail_span!(self, "Unknown discriminant case. Possible values are \"lowercase\", \"UPPERCASE\", \"PascalCase\", \"camelCase\", \"snake_case\", \"UPPER_SNAKE\", \"kebab-case\", or \"UPPER-KEBAB-CASE\"")
```

Code after:
      _ => bail_span!(self, "only public enum allowed"),
    }

    let js_name = opts
      .js_name()
      .map_or_else(|| self.ident.to_string(), |(s, _)| s.to_string());
    let is_string_enum = opts.string_enum().is_some();

    if self
      .variants
      .iter()
      .any(|v| !matches!(v.fields, syn::Fields::Unit))
    {
      let discriminant = opts.discriminant().map_or("type", |(s, _)| s);
      let discriminant_case = opts.discriminant_case().map(|c|
        Ok::<Case, Diagnostic>(match c.0 {
          "lowercase" => Case::Flat,
          "UPPERCASE" => Case::UpperFlat,
          "PascalCase" => Case::Pascal,
          "camelCase" => Case::Camel,
          "snake_case" => Case::Snake,
          "UPPER_SNAKE" => Case::UpperSnake,
          "kebab-case" => Case::Kebab,
          "UPPER-KEBAB-CASE" => Case::UpperKebab,
          _ => {
            bail_span!(self, "Unknown discriminant case. Possible values are \"lowercase\", \"UPPERCASE\", \"PascalCase\", \"camelCase\", \"snake_case\", \"UPPER_SNAKE\", \"kebab-case\", or \"UPPER-KEBAB-CASE\"")
          }
        })
      ).transpose()?;

      let mut errors = vec![];
      let mut variants = vec![];
      for variant in self.variants.iter_mut() {
        let (fields, is_tuple) = convert_fields(&mut variant.fields, false)?;
        for field in fields.iter() {
          if field.js_name == discriminant {
            errors.push(err_span!(
              field.name,
              r#"field's js_name("{}") and discriminator("{}") conflict"#,
              field.js_name,
              discriminant,
            ));
          }
        }
        variants.push(NapiStructuredEnumVariant {
          name: variant.ident.clone(),
          fields,
          is_tuple,
        });
      }
      let rust_struct_ident = self.ident.clone();