Skip to content

Add JSONPath scalar type and codec support #2571

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

slaskis
Copy link

@slaskis slaskis commented Jun 13, 2025

Description

I have been patching postgraphile to add support for jsonpath and thought it might make sense to add upstream.

Performance impact

unknown, negligible I would presume since it just adds a codec

Security impact

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

@github-project-automation github-project-automation bot moved this to 🌳 Triage in V5.0.0 Jun 13, 2025
Copy link

changeset-bot bot commented Jun 13, 2025

⚠️ No Changeset found

Latest commit: ce8753d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

Looks good to me! Please:

  1. Add a column to the b.types table: https://github.com/graphile/crystal/blob/main/postgraphile/postgraphile/__tests__/kitchen-sink-schema.sql#L275
  2. Insert null into the column value for the first b.types row: https://github.com/graphile/crystal/blob/main/postgraphile/postgraphile/__tests__/kitchen-sink-data.sql#L158
  3. Insert a sensible expression into the second b.types row: https://github.com/graphile/crystal/blob/main/postgraphile/postgraphile/__tests__/kitchen-sink-data.sql#L208
  4. Add a column to the types mutation update and create operations:
    ltreeArray: ["Bar.Baz.Qux", "Bar.Foo.Fah"]
    and
    ltreeArray: ["Bar.Baz.Qux", "Bar.Foo.Fah"]
  5. Ensure that the value is queried in the response to the mutation and to the types query: and https://github.com/graphile/crystal/blob/main/postgraphile/postgraphile/__tests__/queries/v4/types.test.graphql#L197
  6. Run the full test suite with envvar UPDATE_SNAPSHOTS=1

Thanks!

@github-project-automation github-project-automation bot moved this from 🌳 Triage to 🌱 In Progress in V5.0.0 Jun 16, 2025
@slaskis
Copy link
Author

slaskis commented Jun 16, 2025

Great review thanks! 🙏 i was unable to get it to build and test (unrelated to this PR) but i’ll have another go at it later this week.

@slaskis slaskis marked this pull request as ready for review June 19, 2025 06:39
@slaskis
Copy link
Author

slaskis commented Jun 19, 2025

All right, I managed to get the build and tests to run in an Ubuntu VM so it's looking a lot better now!

A few whitespace changes snuck in, if you want me to revert those let me know!

@slaskis slaskis requested a review from benjie June 19, 2025 06:54
Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

Looks good!

Might make sense for us to implement default behaviors so that orderBy/condition on jsonPath is disabled by default. You can leave that with me if you want because I can't remember how to do it off-hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🌱 In Progress
Development

Successfully merging this pull request may close these issues.

2 participants