graphiti icon indicating copy to clipboard operation
graphiti copied to clipboard

'string_enum' is not allowing 'not_eq' operator

Open aravindaytha12 opened this issue 4 years ago • 3 comments

Hi * need a small suggestion,

  • Currently 'string_enum attribute' allowing only 'eq' operator but does not allows 'not_eq' operator
  • Is there any specific reason for not considering 'string_enum' in default_operators list
  • Only canonical name 'enum' is considered for both 'string_enum' and 'integer_enum' at default_operators method

- Reference:

  https://github.com/graphiti-api/graphiti/blob/master/lib/graphiti/filter_operators.rb#L8
  https://github.com/graphiti-api/graphiti/blob/master/lib/graphiti/adapters/abstract.rb#L27

- Example:

  MyResource.all({ filter: { status: { eq: 'done' } } }).data # 'eq' is allowed operator for 'string_enum'
  MyResource.all({ filter: { status: { not_eq: 'done' } } }).data # Throws us an error, Supported operators are [:eq]

aravindaytha12 avatar Feb 02 '22 16:02 aravindaytha12

  • I think this was an oversight
  • Let's add it!
  • Correct

richmolj avatar Feb 08 '22 12:02 richmolj

  • I think this was an oversight
  • Let's add it!
  • Correct

Thanks for the reply, Can please look into this Pull_request, if this considerable https://github.com/graphiti-api/graphiti/pull/403

aravindaytha12 avatar Feb 09 '22 10:02 aravindaytha12

I just ran into this as well. Is the PR supplied sufficient for the managing team to merge in? It looked simple enough.

elDub avatar Aug 17 '23 13:08 elDub