Skip to content

Conversation

@mjfwebb
Copy link
Contributor

@mjfwebb mjfwebb commented Mar 1, 2023

Description

This PR adds escaping to relationship type strings.

There is a need for an unescaped version of the relationship type string so this is added as a new property typeUnescaped

This PR also includes some small type and typo fixes that were in the periphery :)

Complexity

Low

@changeset-bot
Copy link

changeset-bot bot commented Mar 1, 2023

🦋 Changeset detected

Latest commit: 2453604

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

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 1, 2023

Performance Report

No Performance Changes

Show Full Table
name dbHits old dbHits time (ms) old time (ms) maxRows
aggregations.TopLevelAggregate 3403 3403 44 56 1134
aggregations.NestedAggregation 13514 13514 106 117 2174
aggregations.AggregationWithWhere 10942 10942 63 94 2174
aggregations.AggregationWhereWithinNestedRelationships 20101954 20101954 2979 3161 2008534
aggregations.AggregationWhereWithinNestedConnections 20101954 20101954 2862 2669 2008534
aggregations.NestedCountFromMovieToActors 8694 8694 66 119 2174
aggregations.NestedCountFromActorsToMovie 8900 8900 77 65 2174
aggregations.DeeplyNestedCount 12062312 12062294 5284 5005 2008534
batch-create.BatchCreate 3600 3600 211 126 600
connect.createAndConnect 12419 12419 182 338 3003
connections.Connection 13042 13042 143 160 2174
connections.NestedConnection 38231 38231 140 156 4516
connections.ConnectionWithSort 2277 2277 67 94 1040
connections.ConnectionWithSortAndCypher 14278 14278 96 139 2174
create.SimpleMutation 6 6 34 40 1
cypher-directive.TopLevelMutationDirective 1135 1135 85 59 1134
delete.SimpleDelete 18361 18361 262 268 1040
delete.NestedDeleteInUpdate 16779 16779 275 236 2040
query.SimpleQuery 14120 14120 213 164 2174
query.QueryWhere 8665 8665 44 52 2163
query.SimpleQueryWithNestedWhere 8836 8836 55 84 2163
query.Nested 10084290 10084290 10883 10644 2008534
query.NestedWithFilter 37172 37172 129 154 4511
query.OrFilterOnRelationships 36785 35747 183 210 1769
query.OrFilterOnRelationshipsAndNested 30495 29457 225 243 1769
query.QueryWithNestedIn 12711 12153 65 68 1338
query.NestedConnectionWhere 8794 8794 58 87 2174
query.DeeplyNestedConnectionWhere 8869 8869 79 127 2174
query.DeeplyNestedWithRelationshipFilters 6251 6251 131 198 1134
query.NestedWithRelationshipSingleFilters 3021189 3021189 611 623 1003942
query.Fulltext 96 96 35 34 16
query.FulltextWithNestedQuery 571 571 52 62 84
sorting.SortMultipleTypes 2493 2493 71 128 1040
sorting.SortMultipleTypesWithCypherWithCypher 13519 13519 94 124 2174
sorting.SortOnNestedFields 13042 13042 84 117 2174
sorting.SortDeeplyNestedFields 38965 38965 129 156 4516
sorting.SortWithTopLevelCypher 14120 14120 82 64 2174
unions.SimpleUnionQuery 321 321 68 86 35
unions.SimpleUnionQueryWithMissingFields 293 293 85 71 35
unions.NestedUnion 398553 398553 411 445 33033
unions.NestedUnionWithMissingFields 372527 372527 297 478 33033
update.NestedUpdate 2119 2119 52 58 1040

Old Schema Generation: 41.218s
Schema Generation: 39.873s

@darrellwarde
Copy link
Contributor

So, a couple of extra things we'll need here:

  • A changeset describing the changes. You generate one of these by running yarn changeset in the root of the repository, and the wizard will walk you through. This change will need a major bump of the @neo4j/graphql only, with an appropriate changelog entry.
  • Documentation:
    • An entry in the migration guide describing that if users have previously escaped their relationship types, they should remove them now.
    • I would also suggest describing that relationship types are automatically escaped in the documentation pages surrounding relationships.

But I think this is a nice and clean enough solution until we improve schema generation!

callbacks?: Neo4jGraphQLCallbacks;
customResolvers?: IResolvers | Array<IResolvers>;
}) {
}): ObjectFields {
Copy link
Contributor

Choose a reason for hiding this comment

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

can also remove the cast at the end now (as ObjectFields), right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sadly not since it is potentially undefined due to obj.fields being potentially undefined.


const direction = directionArg.value.value as "IN" | "OUT";
const type = typeArg.value.value;
const type = `\`${typeArg.value.value}\``;
Copy link
Contributor

Choose a reason for hiding this comment

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

can Cypher.utils.escapeLabel not be used here? I think this is the source of truth at the moment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, that's nice, thanks!

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.

Outside of the code, just a couple of comments!

@mjfwebb mjfwebb requested review from a-alle and darrellwarde March 6, 2023 07:15
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.

LGTM, nice changes!

@mjfwebb mjfwebb merged commit 9f3a937 into neo4j:4.0.0 Mar 6, 2023
@mjfwebb mjfwebb deleted the escape-relationship-type-strings branch March 6, 2023 08:33
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.

4 participants