GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JSON Schema $or querySyntax should allow additional properties · Issue #3550 · feathersjs/feathers

JSON Schema $or querySyntax should allow additional properties #3550

New issue
Copy link
New issue
Copy link
Open
Open
JSON Schema $or querySyntax should allow additional properties#3550
Copy link

Description

@ha6755ad
ha6755ad
opened on Nov 12, 2024
Issue body actions

A common use-case would be I have a complex nested object in my schema and I want to run an $or query for 'some.nested.path': true

In order to do this I have to list 'some.nested.path' separately in my querySchema. I think for paths containing types like ObjectIds this makes sense because there is a data transformation taking place. However, for simple types like a boolean, string, number, etc. the query would run just fine if I simply changed my querySchema to additionalProperties: true.

Suggestion to make $or, $and, etc allow additional properties optionally as well.

Activity

  1. EmileSpecs commented on Nov 14, 2024

    @EmileSpecs
    EmileSpecs
    on Nov 14, 2024
    More actions

    Hi @ha6755ad

    Do I understand correctly though that you have gotten this to work?

    I can't get it to work, I get the error: "message: 'must NOT have additional properties'"

    I'm trying to query:

    query: {
    $or = [
          { reference: { $ilike: `%${search.value}%` } },
          { 'account.name': { $ilike: `%${search.value}%` } }
        ]
    }
    

    And my querySchema is defined:

    export const invoiceQuerySchema = Type.Intersect(
      [
        querySyntax(invoiceQueryProperties, {
          reference: {
            $ilike: Type.String()
          }
        }),
        // Add additional query properties here
        Type.Object({
          // Allow querying invoices by relations and specific context
          'account.name': queryProperty(Type.String(), {
            $ilike: Type.String()
          })
        }, { additionalProperties: false })
      ],
      { additionalProperties: false }
    )
    

    When I query 'account.name' outside of the $or it works fine, no error.
    Also using it inside the $or but commenting out the query validation hook also works.

    For me setting additionalProperties: true makes no difference, I still get the same error.

    So it's just a validation issue, it all works as expected.
    Can you provide an example of how you specified the relational query syntax?

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.