Skip to content

Fixed issue with bool props when generating an enhanced schema #333

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

Merged
merged 4 commits into from
May 13, 2025

Conversation

alexthomas93
Copy link
Contributor

Description

This PR fixes an issue with the get_enhanced_schema_cypher function which was failing if the schema included a boolean property.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update
  • Project configuration change

Complexity

Low

How Has This Been Tested?

  • Unit tests
  • E2E tests
  • Manual tests

Checklist

The following requirements should have been met (depending on the changes in the branch):

  • Documentation has been updated
  • Unit tests have been updated
  • E2E tests have been updated
  • Examples have been updated
  • New files have copyright header
  • CLA (https://neo4j.com/developer/cla/) has been signed
  • CHANGELOG.md updated if appropriate

Comment on lines +756 to +759
if not output_dict:
return f"{match_clause}\nRETURN {{}} AS output"
# Combine with and return clauses
with_clause = "WITH " + ",\n ".join(with_clauses)
with_clause = "WITH " + ",\n ".join(with_clauses) if with_clauses else ""
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test that covers this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the unit tests to check the full query string returned by the get_enhanced_schema_cypher function.

The first two lines here are covered by the boolean, point, and duration cases of the test_get_enhanced_schema_cypher test.

The third line here is covered by the test_enhanced_schema_cypher_string_exhaustive_false_with_index test, previously the query generated by this test was:

MATCH (n:`Person`) WITH n LIMIT 5
WITH 
RETURN {`status`: {values: ['Single', 'Married', 'Divorced'], distinct_count: 3}} AS output

Which is incorrect Cypher. As we didn't check the full query we didn't catch this.

Copy link
Member

@oskarhane oskarhane left a comment

Choose a reason for hiding this comment

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

🛝 LGTM
Thanks for updating the tests.

@alexthomas93 alexthomas93 merged commit b36967d into neo4j:main May 13, 2025
7 checks passed
@alexthomas93 alexthomas93 deleted the bugfix/enhanced-schema-bool branch May 13, 2025 09:43
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.

2 participants