Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove implicit filter fields #5801

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .changeset/red-cows-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
"@neo4j/graphql": major
---

Implicit filtering fields have been removed, please use the explicit versions:

```graphql
# Old syntax
{
movies(where: { title: "The Matrix" }) {
title
}
}

# New syntax
{
movies(where: { title_EQ: "The Matrix" }) {
title
}
}
```

The `implicitEqualFilters` option of `excludeDeprecatedFields` has been removed.
14 changes: 0 additions & 14 deletions packages/graphql/src/schema/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@

import { DEPRECATED } from "../constants";

export const DEPRECATE_IMPLICIT_EQUAL_FILTERS = {
name: DEPRECATED,
args: {
reason: "Please use the explicit _EQ version",
},
};

export const DEPRECATE_DIRECTED_ARGUMENT = {
name: DEPRECATED,
args: {
reason: "The directed argument is deprecated, and the direction of the field will be configured in the GraphQL server",
},
};

export const DEPRECATE_IMPLICIT_SET = {
name: DEPRECATED,
args: {
Expand Down
12 changes: 2 additions & 10 deletions packages/graphql/src/schema/generation/aggregate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ import type { RelationshipAdapter } from "../../schema-model/relationship/model-
import { RelationshipDeclarationAdapter } from "../../schema-model/relationship/model-adapters/RelationshipDeclarationAdapter";
import type { Neo4jFeaturesSettings } from "../../types";
import type { AggregationTypesMapper } from "../aggregations/aggregation-types-mapper";
import { DEPRECATE_IMPLICIT_EQUAL_FILTERS } from "../constants";
import { numericalResolver } from "../resolvers/field/numerical";
import { graphqlDirectivesToCompose } from "../to-compose";
import { shouldAddDeprecatedFields } from "./utils";

export function withAggregateSelectionType({
entityAdapter,
Expand Down Expand Up @@ -111,12 +109,6 @@ export function withAggregateInputType({
},
});

if (shouldAddDeprecatedFields(features, "implicitEqualFilters")) {
aggregateWhereInput.addFields({
count: { type: GraphQLInt, directives: [DEPRECATE_IMPLICIT_EQUAL_FILTERS] },
});
}

aggregateWhereInput.addFields({
AND: aggregateWhereInput.NonNull.List,
OR: aggregateWhereInput.NonNull.List,
Expand Down Expand Up @@ -251,8 +243,8 @@ function addAggregationFieldsByType(
const averageType = attribute.typeHelper.isBigInt()
? "BigInt"
: attribute.typeHelper.isDuration()
? "Duration"
: GraphQLFloat;
? "Duration"
: GraphQLFloat;
fields[`${attribute.name}_AVERAGE_${operator}`] = { type: averageType, directives: deprecatedDirectives };
}
return fields;
Expand Down
8 changes: 0 additions & 8 deletions packages/graphql/src/schema/get-where-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { DEPRECATED } from "../constants";
import type { AttributeAdapter } from "../schema-model/attribute/model-adapters/AttributeAdapter";
import { ConcreteEntityAdapter } from "../schema-model/entity/model-adapters/ConcreteEntityAdapter";
import type { Neo4jFeaturesSettings } from "../types";
import { DEPRECATE_IMPLICIT_EQUAL_FILTERS } from "./constants";
import { shouldAddDeprecatedFields } from "./generation/utils";
import { graphqlDirectivesToCompose } from "./to-compose";

// TODO: refactoring needed!
Expand Down Expand Up @@ -81,12 +79,6 @@ export function getWhereFieldsForAttributes({
}
}

if (shouldAddDeprecatedFields(features, "implicitEqualFilters")) {
result[field.name] = {
type: field.getInputTypeNames().where.pretty,
directives: deprecatedDirectives.length ? deprecatedDirectives : [DEPRECATE_IMPLICIT_EQUAL_FILTERS],
};
}
result[`${field.name}_EQ`] = {
type: field.getInputTypeNames().where.pretty,
directives: deprecatedDirectives,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/src/schema/resolvers/query/global-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function globalNodeResolver({ entities }: { entities: ConcreteEntityAdapt
const resolveTree = {
name: entityAdapter.plural,
alias: "node",
args: { where: { [field]: id } },
args: { where: { [`${field}_EQ`]: id } },
fieldsByTypeName,
};

Expand Down
Loading
Loading