Skip to content

OData+Swagger - $filter properties hidden if all properties are allowed #757

Closed
@spaasis

Description

@spaasis

Hi, and thanks (again) for your great work!

I ran into something that is working as intended but is an ill fit for my use case.

By default the api-versioning does not display e.q. OData $filter property names if every property is can be used as a filter: https://github.com/microsoft/aspnet-api-versioning/blob/e16b579d240574053ebd8e7ee38c8686beaee174/src/Common.OData.ApiExplorer/AspNet.OData/Builder/ODataAttributeVisitor.cs#L303

I hit a snag with a class with only two properties, both of which can be used as $filter. It took me a while to find out why this particular endpoint didn't list the properties while all others did.

I like to explicitly show all the available properties (for easier copy-pasting for example), even though the lists can admittedly grow quite long:
image

Now, I think the default behavior is absolutely sensible. What do you think about adding a configuration to toggle this behavior or only perform the cleaning if there are e.g. >5 properties listed?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions