-
Notifications
You must be signed in to change notification settings - Fork 1
Add unified query DSL with MongoDB-style operators #52
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| title: ComparisonOperator | ||
| description: ComparisonOperator Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **$gt** | `number \| string` | optional | | | ||
| | **$gte** | `number \| string` | optional | | | ||
| | **$lt** | `number \| string` | optional | | | ||
| | **$lte** | `number \| string` | optional | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| title: EqualityOperator | ||
| description: EqualityOperator Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **$eq** | `any` | optional | | | ||
| | **$ne** | `any` | optional | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| title: FieldOperators | ||
| description: FieldOperators Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **$eq** | `any` | optional | | | ||
| | **$ne** | `any` | optional | | | ||
| | **$gt** | `number \| string` | optional | | | ||
| | **$gte** | `number \| string` | optional | | | ||
| | **$lt** | `number \| string` | optional | | | ||
| | **$lte** | `number \| string` | optional | | | ||
| | **$in** | `any[]` | optional | | | ||
| | **$nin** | `any[]` | optional | | | ||
| | **$between** | `any[]` | optional | | | ||
| | **$contains** | `string` | optional | | | ||
| | **$startsWith** | `string` | optional | | | ||
| | **$endsWith** | `string` | optional | | | ||
| | **$null** | `boolean` | optional | | | ||
| | **$exist** | `boolean` | optional | | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| title: FilterCondition | ||
| description: FilterCondition Schema Reference | ||
| --- | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| title: NormalizedFilter | ||
| description: NormalizedFilter Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **$and** | `Record<string, object> \| any[]` | optional | | | ||
| | **$or** | `Record<string, object> \| any[]` | optional | | | ||
| | **$not** | `Record<string, object> \| any` | optional | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| title: QueryFilter | ||
| description: QueryFilter Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **where** | `any` | optional | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| title: RangeOperator | ||
| description: RangeOperator Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **$between** | `any[]` | optional | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| title: SetOperator | ||
| description: SetOperator Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **$in** | `any[]` | optional | | | ||
| | **$nin** | `any[]` | optional | | |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||||
| --- | ||||||
| title: SpecialOperator | ||||||
| description: SpecialOperator Schema Reference | ||||||
| --- | ||||||
|
|
||||||
| ## Properties | ||||||
|
|
||||||
| | Property | Type | Required | Description | | ||||||
| | :--- | :--- | :--- | :--- | | ||||||
| | **$null** | `boolean` | optional | | | ||||||
| | **$exist** | `boolean` | optional | | | ||||||
|
||||||
| | **$exist** | `boolean` | optional | | | |
| | **$exists** | `boolean` | optional | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| title: StringOperator | ||
| description: StringOperator Schema Reference | ||
| --- | ||
|
|
||
| ## Properties | ||
|
|
||
| | Property | Type | Required | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **$contains** | `string` | optional | | | ||
| | **$startsWith** | `string` | optional | | | ||
| | **$endsWith** | `string` | optional | | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| { | ||
| "$ref": "#/definitions/ComparisonOperator", | ||
| "definitions": { | ||
| "ComparisonOperator": { | ||
| "type": "object", | ||
| "properties": { | ||
| "$gt": { | ||
| "anyOf": [ | ||
| { | ||
| "type": "number" | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "format": "date-time" | ||
| } | ||
| ] | ||
| }, | ||
| "$gte": { | ||
| "anyOf": [ | ||
| { | ||
| "type": "number" | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "format": "date-time" | ||
| } | ||
| ] | ||
| }, | ||
| "$lt": { | ||
| "anyOf": [ | ||
| { | ||
| "type": "number" | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "format": "date-time" | ||
| } | ||
| ] | ||
| }, | ||
| "$lte": { | ||
| "anyOf": [ | ||
| { | ||
| "type": "number" | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "format": "date-time" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
| } | ||
| }, | ||
| "$schema": "http://json-schema.org/draft-07/schema#" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "$ref": "#/definitions/EqualityOperator", | ||
| "definitions": { | ||
| "EqualityOperator": { | ||
| "type": "object", | ||
| "properties": { | ||
| "$eq": {}, | ||
| "$ne": {} | ||
| }, | ||
| "additionalProperties": false | ||
| } | ||
| }, | ||
| "$schema": "http://json-schema.org/draft-07/schema#" | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,108 @@ | ||||||
| { | ||||||
| "$ref": "#/definitions/FieldOperators", | ||||||
| "definitions": { | ||||||
| "FieldOperators": { | ||||||
| "type": "object", | ||||||
| "properties": { | ||||||
| "$eq": {}, | ||||||
| "$ne": {}, | ||||||
| "$gt": { | ||||||
| "anyOf": [ | ||||||
| { | ||||||
| "type": "number" | ||||||
| }, | ||||||
| { | ||||||
| "type": "string", | ||||||
| "format": "date-time" | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| "$gte": { | ||||||
| "anyOf": [ | ||||||
| { | ||||||
| "type": "number" | ||||||
| }, | ||||||
| { | ||||||
| "type": "string", | ||||||
| "format": "date-time" | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| "$lt": { | ||||||
| "anyOf": [ | ||||||
| { | ||||||
| "type": "number" | ||||||
| }, | ||||||
| { | ||||||
| "type": "string", | ||||||
| "format": "date-time" | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| "$lte": { | ||||||
| "anyOf": [ | ||||||
| { | ||||||
| "type": "number" | ||||||
| }, | ||||||
| { | ||||||
| "type": "string", | ||||||
| "format": "date-time" | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| "$in": { | ||||||
| "type": "array" | ||||||
| }, | ||||||
| "$nin": { | ||||||
| "type": "array" | ||||||
| }, | ||||||
| "$between": { | ||||||
| "type": "array", | ||||||
| "minItems": 2, | ||||||
| "maxItems": 2, | ||||||
| "items": [ | ||||||
| { | ||||||
| "anyOf": [ | ||||||
| { | ||||||
| "type": "number" | ||||||
| }, | ||||||
| { | ||||||
| "type": "string", | ||||||
| "format": "date-time" | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "anyOf": [ | ||||||
| { | ||||||
| "type": "number" | ||||||
| }, | ||||||
| { | ||||||
| "type": "string", | ||||||
| "format": "date-time" | ||||||
| } | ||||||
| ] | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| "$contains": { | ||||||
| "type": "string" | ||||||
| }, | ||||||
| "$startsWith": { | ||||||
| "type": "string" | ||||||
| }, | ||||||
| "$endsWith": { | ||||||
| "type": "string" | ||||||
| }, | ||||||
| "$null": { | ||||||
| "type": "boolean" | ||||||
| }, | ||||||
| "$exist": { | ||||||
|
||||||
| "$exist": { | |
| "$exists": { |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "$ref": "#/definitions/FilterCondition", | ||
| "definitions": { | ||
| "FilterCondition": { | ||
| "allOf": [ | ||
| { | ||
| "type": "object", | ||
| "additionalProperties": {} | ||
| }, | ||
| { | ||
| "type": "object", | ||
| "properties": { | ||
| "$and": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "$or": { | ||
| "type": "array", | ||
| "items": {} | ||
| }, | ||
| "$not": {} | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "$schema": "http://json-schema.org/draft-07/schema#" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property should be
$exists(with an 's') to match MongoDB's standard operator name.