Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid input value error when filtering on a computed field with enum type #8344

Open
lsdch opened this issue Feb 17, 2025 · 0 comments
Open

Comments

@lsdch
Copy link

lsdch commented Feb 17, 2025

Given the schema below, filtering on an enum computed property (.category of type DatasetCategory in my case) gives error :

InvalidValueError: invalid input value for enum 'datasets::DatasetCategory': "BaseObject"

Example query that fails :

with opts := <json>to_json('{}'),
# with opts := <json>to_json('{"category": "Site"}') # providing a value gives the same error
category := <datasets::DatasetCategory>json_get(opts, 'category')
select datasets::Dataset { ** }
filter .category = (category ?? .category)

However select queries without filtering on .category works as expected in EdgeDB UI, and the field type is correctly assigned to a DatasetCategory enum element.

Image


  • EdgeDB Version: 6.0-dev.9079+9d120cc
  • EdgeDB CLI Version: 6.1.2+af38353
  • OS Version: Linux Mint 22.1

Schema:

module datasets {

  scalar type DatasetCategory extending enum<Site, Occurrence, Seq>;

  abstract type Dataset extending default::Auditable {
    required label: str {
      constraint min_len_value(4);
      constraint max_len_value(40);
    };
    required slug: str {
      constraint exclusive;
    };

   # Strips module path and "Dataset" suffix from concrete object name
    required category := <DatasetCategory>str_replace(
      str_split(.__type__.name, "::")[1],
      "Dataset", ""
    );
  }

  type SiteDataset extending Dataset {
     # ...
  }
  type OccurrenceDataset extending Dataset {
    # ...
  }
  type SeqDataset extending Dataset {
    # ...
  }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant