After compiling an updated version of our API with the latest SS builds, queries we had previously written that relied on the AutoQuery ImplicitConventions seem to have stopped working. For example, a URL such as this one:
no longer returns any results, though
works just fine.
We've got several tests for implicit queries and I've just upgraded Northwind to use the latest pre-release version on MyGet which is working as expected, e.g:
and AutoQuery Viewer works based on implicit queries:
We'll need a stand-alone repro we can run locally that shows the issue.
I've narrowed the issue down - if the field being filtered on is a string field, everything works fine, as per your example (and I just confirmed on our side as well). The issue we are having is when the field being filtered on is an Enum. It seems the ImplicitConventions no longer work there. If it matters, in our case, the Enum in question is marked with EnumAsInt. Again, we are confident this was working up until recently.
The issue is trying to convert a partial enum value into an enum which fails. What version was this meant to have worked in?
Tough question - we're pretty sure it was working on whatever was latest about 3 months ago. Either way - is there some way to make it happen now? Also, to be clear, while partial conversion would be outstanding, so long as it can just convert the full enum name that would be fine. We don't recall partial working previously either.
The issue is because it's trying to convert a string of a partial enum into a full Enum, I wanted to know the previous version it worked in so I can investigate how it was meant to have worked previously.
What is a query that was working before that's not working now?
That's what I provided in the OP.
Where New is a complete value from the enum.
I've already told you why partial enums fail, they weren't ever intended to "work" (or whatever that's supposed to mean here). If it ever did, it did by accident.
If you have a repro showing a query where a full Enum doesn't work, please provide it.
I'm not talking about partial enums. I'm talking about using Contains on a value of New, when New is a complete (NOT PARTIAL) value in the enum.
I've added more tests showing Querying String Enums working as expected and querying int Enums works with exact matches, but I don't see how you could Query Enums stored as ints using an SQL Contains query could work so I've created a TestApp that includes a simple AutoQuery Service of a Type with Enums using the 5 month old v4.5.8 where this isn't working as expected either.
Please send a PR to this or create a stand-alone test project that we can run locally that shows the version of ServiceStack where this has ever worked.
Thanks for doing that. It must be our mistake then (two of us remembered it working, but clearly we were mistaken). In any event, is there a way to write a custom filter to get it to work?
Use a QueryDbFilter, although an SQL Contains query for string fields isn't going to work on ints, so use a query that does an integer comparison.