jsonapi icon indicating copy to clipboard operation
jsonapi copied to clipboard

Filtering with empty value

Open tameroski opened this issue 7 years ago • 3 comments

json/contenttype?filter[field]= returns all entries instead of entries with field value empty. Not sure this is the desired behaviour, is it ?

tameroski avatar Aug 24 '17 16:08 tameroski

I'm not entirely sure if it should work like that, maybe try ?filter[field]=! instead?

Edit: No never mind what I said, that's only for checking non-empty. I don't think you can filter for empty values.

xiaohutai avatar Sep 06 '17 08:09 xiaohutai

Leaving this ticket open so that others may see.

JSON API does not support this (issue might be outdated) and as far as I know, Bolt doesn't either.

I think the problem is then empty string vs null.

Depending on what you want, you can:

  • Query them all and then filter it on your service.
  • An extension that listens to a save event, and then sets a (hidden) field to something that can be for querying.

xiaohutai avatar Jul 30 '18 11:07 xiaohutai

Looks like it might be an option now? https://github.com/json-api-dotnet/JsonApiDotNetCore/pull/387

jimcue avatar Oct 02 '19 11:10 jimcue