{"id":14976175,"url":"https://github.com/titaniumit/graphql-filters","last_synced_at":"2026-02-01T21:35:16.501Z","repository":{"id":207034577,"uuid":"718268017","full_name":"TitaniumIT/graphql-filters","owner":"TitaniumIT","description":"Provides a C# library to implement Graphql Filters ","archived":false,"fork":false,"pushed_at":"2024-12-23T23:39:42.000Z","size":2016,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-15T05:04:40.079Z","etag":null,"topics":["dotnet","graphql","graphql-server"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TitaniumIT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-13T18:26:46.000Z","updated_at":"2024-09-30T21:14:04.000Z","dependencies_parsed_at":"2024-01-08T19:29:27.860Z","dependency_job_id":"79f4f6ae-f8df-474a-8ed6-640b01560d54","html_url":"https://github.com/TitaniumIT/graphql-filters","commit_stats":{"total_commits":127,"total_committers":4,"mean_commits":31.75,"dds":"0.30708661417322836","last_synced_commit":"4f904b8de2bddbb04bfbe61a4649214f8a4c8d8d"},"previous_names":["titaniumit/graphql-filters"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TitaniumIT/graphql-filters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TitaniumIT%2Fgraphql-filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TitaniumIT%2Fgraphql-filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TitaniumIT%2Fgraphql-filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TitaniumIT%2Fgraphql-filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TitaniumIT","download_url":"https://codeload.github.com/TitaniumIT/graphql-filters/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TitaniumIT%2Fgraphql-filters/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262969886,"owners_count":23392530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","graphql","graphql-server"],"created_at":"2024-09-24T13:53:26.103Z","updated_at":"2026-02-01T21:35:16.467Z","avatar_url":"https://github.com/TitaniumIT.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\r\n\r\n[![publish Graphql Filters](https://github.com/TitaniumIT/graphql-filters/actions/workflows/publishpackage.yml/badge.svg)](https://github.com/TitaniumIT/graphql-filters/actions/workflows/publishpackage.yml)\r\n[![coverage](docs/coverage/badge_combined.svg)](https://titaniumit.github.io/graphql-filters/coverage/index.html)\r\n[![testoutcome](docs/testoutcome.svg)](https://titaniumit.github.io/graphql-filters/tests/GraphQL.Filters.Specflow.html)\r\n\r\nAn extention on GraphQL.net to add filtering on clr types\r\n\r\n# Example graphql filters\r\n\r\nFilters are based on a clrType/interface\r\n\r\nUsing AddFilter as argument.  The graphql type for the filters are automaticly added\r\n\r\n* FilterGraphType\u003ctypename\u003e\r\n* And/Or/Not types\r\n* Condition type\r\n* Any\r\n\r\n## Simple filters \r\n\r\n```graphql\r\ncondition:{\r\n    fieldName:Id\r\n    operator: equal\r\n    value: 1\r\n}\r\n```\r\n\r\n```graphql\r\ncondition:{\r\n    fieldName: DateField\r\n    operator: equal\r\n    value: \"10-10-2023\" \r\n}\r\n```\r\n### Operators on scalars\r\nsupported operators on scalartypes\r\n* equal\r\n* greater\r\n* greaterOrEqual\r\n* less\r\n* lessOrEqual\r\n* notEqual\r\n\r\n \r\n## Booleans\r\nsupported \r\n* and\r\n* or \r\n* not\r\n\r\n## Collections\r\nto filter collection members the any field on the filtertype is present\r\nthat contains per colletion field a member.\r\n\r\n## Resolvers\r\n\r\nUsing filters in a Resolver.  \r\n\r\n```csharp\r\nField\u003cDiverGraphType\u003e(\"Diver\")\r\n    .AddFilter(\"filter\").FilterType\u003cDiver\u003e()\r\n    .Resolve(ctx =\u003e\r\n    {\r\n        var filter = ctx.GetFilterExpression\u003cDiver\u003e(\"filter\");\r\n        var datasource = ctx.RequestServices!.GetRequiredService\u003cIDivers\u003e();\r\n        if (filter != null)\r\n            return datasource.Divers.SingleOrDefault(filter.Compile());\r\n        else\r\n            return null;\r\n    });\r\n```\r\n\r\nWhen getting a filter on parent for a child\r\n```csharp\r\n Field\u003cListGraphType\u003cDiveGraphType\u003e\u003e(\"Dives\")\r\n            .Resolve( ctx =\u003e {\r\n              var datasource = ctx.RequestServices!.GetRequiredService\u003cIDives\u003e();\r\n              var expression = ctx.GetSubFilterExpression\u003cDive\u003e();\r\n              if( expression != null){\r\n                return datasource.Dives.Where( d =\u003e d.Diver?.Id == ctx.Source.Id).Where(expression.Compile());\r\n              } else{\r\n                return datasource.Dives.Where( d =\u003e d.Diver?.Id == ctx.Source.Id);\r\n              }\r\n            });\r\n```\r\n\r\n# query examples\r\n\r\n```graphql\r\nquery GetDiverFixedFilter {\r\n    diver(filter:{\r\n        condition:{\r\n            fieldName:id\r\n            operator: equal\r\n            value: 1\r\n        }\r\n    }){\r\n        name\r\n        email\r\n        id\r\n    }\r\n}\r\n\r\nquery GetDiverByEmail {\r\n    diver(filter:{\r\n        condition:{\r\n            fieldName: email\r\n            operator: equal\r\n            value: \"john@divers.down\"\r\n        }\r\n    }){\r\n        name\r\n        email\r\n        id\r\n    }\r\n}\r\n\r\nquery GetDiversWithCoarseFilters {\r\n    divers(filter:{\r\n        any:{\r\n            courses:{\r\n                condition:{\r\n                    fieldName: name\r\n                    operator:equal\r\n                    value: \"OpenWater\"\r\n                }\r\n            }\r\n        }\r\n    }){\r\n        name\r\n        email\r\n        id\r\n    }\r\n}\r\n\r\nquery GetDiverFilterById($id: ValueScalar!) {\r\n    diver(filter:{\r\n        condition:{\r\n            fieldName:id\r\n            operator: equal\r\n            value: $id\r\n        }\r\n    }){\r\n        id\r\n    }\r\n}\r\n\r\nquery GetDiversWithDivesAt($location:ValueScalar!){\r\n    divers(filter: {\r\n        any:{\r\n            dives:{\r\n                condition:{\r\n                    fieldName:location\r\n                    operator:equal\r\n                    value: $location\r\n                }\r\n            }\r\n        }\r\n    }){\r\n        name\r\n        dives{\r\n            start\r\n            end\r\n        }\r\n    }\r\n}\r\n```\r\n[example project](https://github.com/TitaniumIT/graphql-filters/tree/main/src/GraphQL.Filters/GraphQL.Filters.Examples)\r\n\r\n\r\n# Setup\r\n\r\n\r\n\r\n# Todo\r\n\r\n* documentation\r\n* more test cases\r\n* custom filter functions\r\n* configuration options like, casing.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitaniumit%2Fgraphql-filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftitaniumit%2Fgraphql-filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitaniumit%2Fgraphql-filters/lists"}