Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(schema): Allow to add additional operators to the query syntax #2941

Merged
merged 2 commits into from
Dec 20, 2022

Conversation

daffl
Copy link
Member

@daffl daffl commented Dec 19, 2022

This pull request allows to extend the querySyntax schemas with custom operators like $ilike. In TypeBox this looks like this:

const messageQuerySchema = Type.Intersect(
  [
    // This will additioanlly allow querying for `{ name: { $ilike: 'Dav%' } }`
    querySyntax(messageQueryProperties, {
      name: {
        $ilike: Type.String()
      }
    }),
    // Add additional query properties here
    Type.Object({})
  ],
  { additionalProperties: false }
)

Closes #2759
Closes #2933

@netlify
Copy link

netlify bot commented Dec 19, 2022

Deploy Preview for feathers-dove ready!

Name Link
🔨 Latest commit 0202e91
🔍 Latest deploy log https://app.netlify.com/sites/feathers-dove/deploys/63a0f31a04714f000869b993
😎 Deploy Preview https://deploy-preview-2941--feathers-dove.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@daffl daffl requested a review from marshallswain December 20, 2022 07:06
X extends { [K in keyof T]?: { [key: string]: JSONSchema } }
>(
definition: T,
extensions: X = {} as X
Copy link
Member

Choose a reason for hiding this comment

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

Nice and clean

@marshallswain
Copy link
Member

:shipit:

@daffl daffl merged commit f324940 into dove Dec 20, 2022
@daffl daffl deleted the query-schema-operators branch December 20, 2022 16:26
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants