Skip to content

Conversation

@mjfwebb
Copy link
Contributor

@mjfwebb mjfwebb commented Mar 15, 2023

Description

This PR introduces validation to detect cases where types have duplicate relationship fields.

A duplicate relationship field is when multiple relationship fields are defined on the same type with the same relationship type and the same direction.

Here's an example of duplicate relationship fields:

type Team {
    player1: Person! @relationship(type: "PLAYS_IN", direction: IN)
    player2: Person! @relationship(type: "PLAYS_IN", direction: IN)
    backupPlayers: [Person!]! @relationship(type: "PLAYS_IN", direction: IN)
}

type Person {
    teams: [Team!]! @relationship(type: "PLAYS_IN", direction: OUT)
}

To allow disabling the checks for duplicate relationship fields, the noDuplicateRelationshipFields config option has been added.

Complexity

Medium

@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2023

🦋 Changeset detected

Latest commit: d6a1cb6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@neo4j/graphql Major
@neo4j/graphql-toolbox Patch
@neo4j/graphql-ogm Major
neo-place Patch
neo-push-server Patch
apollo-suscriptions-server Patch
yoga-subscriptions-server Patch
@neo4j/graphql-plugin-subscriptions-amqp Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@neo4j-team-graphql
Copy link
Collaborator

neo4j-team-graphql commented Mar 15, 2023

Performance Report

No Performance Changes

Show Full Table
name dbHits old dbHits time (ms) old time (ms) maxRows
aggregations.TopLevelAggregate 3403 3403 32 40 1134
aggregations.NestedAggregation 14551 14551 82 109 2174
aggregations.AggregationWithWhere 11979 11979 60 87 2174
aggregations.AggregationWhereWithinNestedRelationships 22116987 22116987 2992 3196 2008534
aggregations.AggregationWhereWithinNestedConnections 22116987 22116987 2751 2760 2008534
aggregations.NestedCountFromMovieToActors 9734 9734 75 93 2174
aggregations.NestedCountFromActorsToMovie 9937 9937 54 75 2174
aggregations.DeeplyNestedCount 13070331 13070331 4437 4401 2008534
batch-create.BatchCreate 4200 4200 129 182 600
connect.createAndConnect 14424 14424 216 174 3003
connections.Connection 14082 14082 75 85 2174
connections.NestedConnection 41462 41462 135 141 4516
connections.ConnectionWithSort 2282 2282 58 66 1040
connections.ConnectionWithSortAndCypher 15323 15323 85 107 2174
create.SimpleMutation 7 7 54 60 1
cypher-directive.TopLevelMutationDirective 1135 1135 27 59 1134
delete.SimpleDelete 19401 19401 247 285 1040
delete.NestedDeleteInUpdate 18196 18196 151 284 1179
2925.SingleRelationshipFilter 6468 6468 60 42 1040
query.SimpleQuery 15160 15160 81 79 2174
query.QueryWhere 9718 9677 39 50 2168
query.SimpleQueryWithNestedWhere 9896 9855 52 78 2168
query.Nested 10092037 10092037 9696 9675 2008534
query.NestedWithFilter 40401 40401 119 139 4511
query.OrFilterOnRelationships 41559 43636 167 429 1268
query.OrFilterOnRelationshipsAndNested 34790 37802 306 472 1268
query.QueryWithNestedIn 13378 13227 58 91 1210
query.NestedConnectionWhere 9834 9834 49 61 2174
query.DeeplyNestedConnectionWhere 9958 10074 73 92 2174
query.DeeplyNestedWithRelationshipFilters 6343 6343 117 135 1134
query.NestedWithRelationshipSingleFilters 3024400 3024400 605 594 1003942
query.Fulltext 96 96 23 28 16
query.FulltextWithNestedQuery 587 587 38 45 84
sorting.SortMultipleTypes 2513 2513 59 71 1040
sorting.SortMultipleTypesWithCypherWithCypher 14470 14555 106 92 2174
sorting.SortOnNestedFields 14082 14082 63 86 2174
sorting.SortDeeplyNestedFields 42196 42196 179 139 4516
sorting.SortWithTopLevelCypher 15160 15160 67 53 2174
unions.SimpleUnionQuery 321 321 73 91 35
unions.SimpleUnionQueryWithMissingFields 293 293 59 61 35
unions.NestedUnion 410637 410637 298 360 33033
unions.NestedUnionWithMissingFields 384611 384611 319 333 33033
update.NestedUpdate 2119 2119 73 84 1040

Old Schema Generation: 30.337s
Schema Generation: 28.256s
Old Subgraph Schema Generation: 42.376s
Subgraph Schema Generation: 44.414s

@mjfwebb mjfwebb requested review from Liam-Doodson and darrellwarde and removed request for darrellwarde March 16, 2023 07:46
Copy link
Contributor

@darrellwarde darrellwarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, a few comments! 🙂

@mjfwebb mjfwebb merged commit 15a7f04 into neo4j:4.0.0 Mar 17, 2023
@mjfwebb mjfwebb deleted the restrict-multiple-relationship-fields-with-same-type branch March 17, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants