Enum displaying issue

:warning:This is a template you must use to report issues. :warning:
You can also drag images, videos and include Preformatted text.

Feature(s) impacted

Displaying enum

Observed behavior

I can’t see all the enum values of a field.

Expected behavior

See all the enum values of a field

Failure Logs

No logs

Context

Please provide in this mandatory section, the relevant information about your configuration:

  • Project name: Intent
  • Environment name: Development / aurélienlaclergue

Hi there ! :wave:

I have some issue on displaying an enum field, I don’t know why.

I have one mongoose schema like this:

const schema = Mongoose.Schema({
    ...
    type: {
      type: String,
      required: true,
      enum: ['data', 'documents', 'operation', 'asset', 'equipment']
    },
    ...
  }, {
    timestamps: { createdAt: 'creationDate', updatedAt: 'lastUpdateDate' }
  });

but on the UI, I only see “data” and “documents” on select box:

On my .forestadmin-schema.json, there is:

{
      "field": "type",
      "type": "Enum",
      "defaultValue": null,
      "enums": [
        "data",
        "documents",
        "operation",
        "asset",
        "equipment"
      ],
      "integration": null,
      "isFilterable": true,
      "isPrimaryKey": false,
      "isReadOnly": false,
      "isRequired": true,
      "isSortable": true,
      "isVirtual": false,
      "reference": null,
      "inverseOf": null,
      "validations": [{
        "message": null,
        "type": "is present",
        "value": null
      }]
    }

Also, when I remove “data” or “documents” from the enum, these values are well removed on the UI.
I don’t understand why ‘operation’, ‘asset’ and ‘equipment’ are not displayed on the UI ? :thinking:

Hello @aurelien.laclergue,

Thanks for reaching out :raised_hands:

So, if I understood well, your issue is when you’re trying to edit a record, the possible values for the type field are missing some options.

Could you please go to your type field settings (on edit mode, click on the cog icon next to the type title), edit the settings of the “edit widget” and show what you have?
Should be something like this:

image

Thanks!

Thank you very much for this settings, I never see it ! :pray:

1 Like

Cool! :raised_hands:
Can you see your missing options?
Is it all good for you?

Thanks.