Updating schema.

This commit is contained in:
mike12345567 2024-11-15 17:24:21 +00:00
parent 16872d3688
commit 82c7c089cb
7 changed files with 1198 additions and 599 deletions

View File

@ -457,9 +457,28 @@
} }
}, },
"query": { "query": {
"string": { "logicalOperator": "all",
"column": "value" "onEmptyFilter": "none",
} "groups": [
{
"logicalOperator": "any",
"filters": [
{
"operator": "string",
"field": "name",
"value": "John"
},
{
"operator": "range",
"field": "age",
"value": {
"low": 18,
"high": 100
}
}
]
}
]
}, },
"primaryDisplay": "name" "primaryDisplay": "name"
} }
@ -490,9 +509,28 @@
} }
}, },
"query": { "query": {
"string": { "logicalOperator": "all",
"column": "value" "onEmptyFilter": "none",
} "groups": [
{
"logicalOperator": "any",
"filters": [
{
"operator": "string",
"field": "name",
"value": "John"
},
{
"operator": "range",
"field": "age",
"value": {
"low": 18,
"high": 100
}
}
]
}
]
}, },
"primaryDisplay": "name" "primaryDisplay": "name"
} }
@ -2126,90 +2164,159 @@
"description": "A column used to display rows from this view - usually used when rendered in tables." "description": "A column used to display rows from this view - usually used when rendered in tables."
}, },
"query": { "query": {
"description": "Search parameters for view",
"type": "object", "type": "object",
"required": [],
"properties": { "properties": {
"allOr": { "logicalOperator": {
"type": "boolean", "description": "When using groups this defines whether all of the filters must match, or only one of them.",
"description": "Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used." "type": "string",
"enum": [
"all",
"any"
]
}, },
"string": { "onEmptyFilter": {
"type": "object", "description": "If no filters match, should the view return all rows, or no rows.",
"example": { "type": "string",
"columnName1": "value", "enum": [
"columnName2": "value" "all",
}, "none"
"description": "A map of field name to the string to search for, this will look for rows that have a value starting with the string value.", ]
"additionalProperties": {
"type": "string",
"description": "The value to search for in the column."
}
}, },
"fuzzy": { "groups": {
"type": "object", "description": "A grouping of filters to be applied.",
"description": "Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'." "type": "array",
}, "items": {
"range": { "type": "object",
"type": "object", "properties": {
"description": "Searches within a range, the format of this must be in the format of an object with a \"low\" and \"high\" property.", "logicalOperator": {
"example": { "description": "When using groups this defines whether all of the filters must match, or only one of them.",
"columnName1": { "type": "string",
"low": 10, "enum": [
"high": 20 "all",
"any"
]
},
"filters": {
"description": "A list of filters to apply",
"type": "array",
"items": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"description": "The type of search operation which is being performed.",
"enum": [
"equal",
"notEqual",
"empty",
"notEmpty",
"fuzzy",
"string",
"contains",
"notContains",
"containsAny",
"oneOf",
"range"
]
},
"field": {
"type": "string",
"description": "The field in the view to perform the search on."
},
"value": {
"description": "The value to search for - the type will depend on the operator in use.",
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "object"
},
{
"type": "array"
}
]
}
}
}
},
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"type": "object",
"properties": {
"logicalOperator": {
"description": "When using groups this defines whether all of the filters must match, or only one of them.",
"type": "string",
"enum": [
"all",
"any"
]
},
"filters": {
"description": "A list of filters to apply",
"type": "array",
"items": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"description": "The type of search operation which is being performed.",
"enum": [
"equal",
"notEqual",
"empty",
"notEmpty",
"fuzzy",
"string",
"contains",
"notContains",
"containsAny",
"oneOf",
"range"
]
},
"field": {
"type": "string",
"description": "The field in the view to perform the search on."
},
"value": {
"description": "The value to search for - the type will depend on the operator in use.",
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "object"
},
{
"type": "array"
}
]
}
}
}
}
}
}
}
} }
} }
},
"equal": {
"type": "object",
"description": "Searches for rows that have a column value that is exactly the value set."
},
"notEqual": {
"type": "object",
"description": "Searches for any row which does not contain the specified column value."
},
"empty": {
"type": "object",
"description": "Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value.",
"example": {
"columnName1": ""
}
},
"notEmpty": {
"type": "object",
"description": "Searches for rows which have the specified column."
},
"oneOf": {
"type": "object",
"description": "Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]."
},
"contains": {
"type": "object",
"description": "Searches for a value, or set of values in array column types (such as a multi-select). If an array of search options is provided then it must match all.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
},
"notContains": {
"type": "object",
"description": "The logical inverse of contains. Only works on array column types. If an array of values is passed, the row must not match any of them to be returned in the response.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
},
"containsAny": {
"type": "object",
"description": "As with the contains search, only works on array column types and searches for any of the provided values when given an array.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
} }
} }
}, },
@ -2340,90 +2447,159 @@
"description": "A column used to display rows from this view - usually used when rendered in tables." "description": "A column used to display rows from this view - usually used when rendered in tables."
}, },
"query": { "query": {
"description": "Search parameters for view",
"type": "object", "type": "object",
"required": [],
"properties": { "properties": {
"allOr": { "logicalOperator": {
"type": "boolean", "description": "When using groups this defines whether all of the filters must match, or only one of them.",
"description": "Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used." "type": "string",
"enum": [
"all",
"any"
]
}, },
"string": { "onEmptyFilter": {
"type": "object", "description": "If no filters match, should the view return all rows, or no rows.",
"example": { "type": "string",
"columnName1": "value", "enum": [
"columnName2": "value" "all",
}, "none"
"description": "A map of field name to the string to search for, this will look for rows that have a value starting with the string value.", ]
"additionalProperties": {
"type": "string",
"description": "The value to search for in the column."
}
}, },
"fuzzy": { "groups": {
"type": "object", "description": "A grouping of filters to be applied.",
"description": "Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'." "type": "array",
}, "items": {
"range": { "type": "object",
"type": "object", "properties": {
"description": "Searches within a range, the format of this must be in the format of an object with a \"low\" and \"high\" property.", "logicalOperator": {
"example": { "description": "When using groups this defines whether all of the filters must match, or only one of them.",
"columnName1": { "type": "string",
"low": 10, "enum": [
"high": 20 "all",
"any"
]
},
"filters": {
"description": "A list of filters to apply",
"type": "array",
"items": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"description": "The type of search operation which is being performed.",
"enum": [
"equal",
"notEqual",
"empty",
"notEmpty",
"fuzzy",
"string",
"contains",
"notContains",
"containsAny",
"oneOf",
"range"
]
},
"field": {
"type": "string",
"description": "The field in the view to perform the search on."
},
"value": {
"description": "The value to search for - the type will depend on the operator in use.",
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "object"
},
{
"type": "array"
}
]
}
}
}
},
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"type": "object",
"properties": {
"logicalOperator": {
"description": "When using groups this defines whether all of the filters must match, or only one of them.",
"type": "string",
"enum": [
"all",
"any"
]
},
"filters": {
"description": "A list of filters to apply",
"type": "array",
"items": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"description": "The type of search operation which is being performed.",
"enum": [
"equal",
"notEqual",
"empty",
"notEmpty",
"fuzzy",
"string",
"contains",
"notContains",
"containsAny",
"oneOf",
"range"
]
},
"field": {
"type": "string",
"description": "The field in the view to perform the search on."
},
"value": {
"description": "The value to search for - the type will depend on the operator in use.",
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "object"
},
{
"type": "array"
}
]
}
}
}
}
}
}
}
} }
} }
},
"equal": {
"type": "object",
"description": "Searches for rows that have a column value that is exactly the value set."
},
"notEqual": {
"type": "object",
"description": "Searches for any row which does not contain the specified column value."
},
"empty": {
"type": "object",
"description": "Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value.",
"example": {
"columnName1": ""
}
},
"notEmpty": {
"type": "object",
"description": "Searches for rows which have the specified column."
},
"oneOf": {
"type": "object",
"description": "Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]."
},
"contains": {
"type": "object",
"description": "Searches for a value, or set of values in array column types (such as a multi-select). If an array of search options is provided then it must match all.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
},
"notContains": {
"type": "object",
"description": "The logical inverse of contains. Only works on array column types. If an array of values is passed, the row must not match any of them to be returned in the response.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
},
"containsAny": {
"type": "object",
"description": "As with the contains search, only works on array column types and searches for any of the provided values when given an array.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
} }
} }
}, },
@ -2565,90 +2741,159 @@
"description": "A column used to display rows from this view - usually used when rendered in tables." "description": "A column used to display rows from this view - usually used when rendered in tables."
}, },
"query": { "query": {
"description": "Search parameters for view",
"type": "object", "type": "object",
"required": [],
"properties": { "properties": {
"allOr": { "logicalOperator": {
"type": "boolean", "description": "When using groups this defines whether all of the filters must match, or only one of them.",
"description": "Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used." "type": "string",
"enum": [
"all",
"any"
]
}, },
"string": { "onEmptyFilter": {
"type": "object", "description": "If no filters match, should the view return all rows, or no rows.",
"example": { "type": "string",
"columnName1": "value", "enum": [
"columnName2": "value" "all",
}, "none"
"description": "A map of field name to the string to search for, this will look for rows that have a value starting with the string value.", ]
"additionalProperties": {
"type": "string",
"description": "The value to search for in the column."
}
}, },
"fuzzy": { "groups": {
"type": "object", "description": "A grouping of filters to be applied.",
"description": "Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'." "type": "array",
}, "items": {
"range": { "type": "object",
"type": "object", "properties": {
"description": "Searches within a range, the format of this must be in the format of an object with a \"low\" and \"high\" property.", "logicalOperator": {
"example": { "description": "When using groups this defines whether all of the filters must match, or only one of them.",
"columnName1": { "type": "string",
"low": 10, "enum": [
"high": 20 "all",
"any"
]
},
"filters": {
"description": "A list of filters to apply",
"type": "array",
"items": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"description": "The type of search operation which is being performed.",
"enum": [
"equal",
"notEqual",
"empty",
"notEmpty",
"fuzzy",
"string",
"contains",
"notContains",
"containsAny",
"oneOf",
"range"
]
},
"field": {
"type": "string",
"description": "The field in the view to perform the search on."
},
"value": {
"description": "The value to search for - the type will depend on the operator in use.",
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "object"
},
{
"type": "array"
}
]
}
}
}
},
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"type": "object",
"properties": {
"logicalOperator": {
"description": "When using groups this defines whether all of the filters must match, or only one of them.",
"type": "string",
"enum": [
"all",
"any"
]
},
"filters": {
"description": "A list of filters to apply",
"type": "array",
"items": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"description": "The type of search operation which is being performed.",
"enum": [
"equal",
"notEqual",
"empty",
"notEmpty",
"fuzzy",
"string",
"contains",
"notContains",
"containsAny",
"oneOf",
"range"
]
},
"field": {
"type": "string",
"description": "The field in the view to perform the search on."
},
"value": {
"description": "The value to search for - the type will depend on the operator in use.",
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "object"
},
{
"type": "array"
}
]
}
}
}
}
}
}
}
} }
} }
},
"equal": {
"type": "object",
"description": "Searches for rows that have a column value that is exactly the value set."
},
"notEqual": {
"type": "object",
"description": "Searches for any row which does not contain the specified column value."
},
"empty": {
"type": "object",
"description": "Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value.",
"example": {
"columnName1": ""
}
},
"notEmpty": {
"type": "object",
"description": "Searches for rows which have the specified column."
},
"oneOf": {
"type": "object",
"description": "Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]."
},
"contains": {
"type": "object",
"description": "Searches for a value, or set of values in array column types (such as a multi-select). If an array of search options is provided then it must match all.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
},
"notContains": {
"type": "object",
"description": "The logical inverse of contains. Only works on array column types. If an array of values is passed, the row must not match any of them to be returned in the response.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
},
"containsAny": {
"type": "object",
"description": "As with the contains search, only works on array column types and searches for any of the provided values when given an array.",
"example": {
"arrayColumn": [
"a",
"b"
]
}
} }
} }
}, },

View File

@ -469,8 +469,19 @@ components:
visible: false visible: false
readonly: false readonly: false
query: query:
string: logicalOperator: all
column: value onEmptyFilter: none
groups:
- logicalOperator: any
filters:
- operator: string
field: name
value: John
- operator: range
field: age
value:
low: 18
high: 100
primaryDisplay: name primaryDisplay: name
views: views:
value: value:
@ -492,8 +503,19 @@ components:
visible: false visible: false
readonly: false readonly: false
query: query:
string: logicalOperator: all
column: value onEmptyFilter: none
groups:
- logicalOperator: any
filters:
- operator: string
field: name
value: John
- operator: range
field: age
value:
low: 18
high: 100
primaryDisplay: name primaryDisplay: name
securitySchemes: securitySchemes:
ApiKeyAuth: ApiKeyAuth:
@ -1778,85 +1800,115 @@ components:
description: A column used to display rows from this view - usually used when description: A column used to display rows from this view - usually used when
rendered in tables. rendered in tables.
query: query:
description: Search parameters for view
type: object type: object
required: []
properties: properties:
allOr: logicalOperator:
type: boolean description: When using groups this defines whether all of the filters must
description: Specifies that a row should be returned if it satisfies any of the match, or only one of them.
specified options, rather than requiring it to fulfill all the type: string
search parameters. This defaults to false, meaning AND logic enum:
will be used. - all
string: - any
type: object onEmptyFilter:
example: description: If no filters match, should the view return all rows, or no rows.
columnName1: value type: string
columnName2: value enum:
description: A map of field name to the string to search for, this will look for - all
rows that have a value starting with the string value. - none
additionalProperties: groups:
type: string description: A grouping of filters to be applied.
description: The value to search for in the column. type: array
fuzzy: items:
type: object type: object
description: Searches for a sub-string within a string column, e.g. searching properties:
for 'dib' will match 'Budibase'. logicalOperator:
range: description: When using groups this defines whether all of the filters must
type: object match, or only one of them.
description: Searches within a range, the format of this must be in the format type: string
of an object with a "low" and "high" property. enum:
example: - all
columnName1: - any
low: 10 filters:
high: 20 description: A list of filters to apply
equal: type: array
type: object items:
description: Searches for rows that have a column value that is exactly the type: object
value set. properties:
notEqual: operator:
type: object type: string
description: Searches for any row which does not contain the specified column description: The type of search operation which is being performed.
value. enum:
empty: - equal
type: object - notEqual
description: Searches for rows which do not contain the specified column. The - empty
object should simply contain keys of the column names, these can - notEmpty
map to any value. - fuzzy
example: - string
columnName1: "" - contains
notEmpty: - notContains
type: object - containsAny
description: Searches for rows which have the specified column. - oneOf
oneOf: - range
type: object field:
description: Searches for rows which have a column value that is any of the type: string
specified values. The format of this must be columnName -> description: The field in the view to perform the search on.
[value1, value2]. value:
contains: description: The value to search for - the type will depend on the operator in
type: object use.
description: Searches for a value, or set of values in array column types (such oneOf:
as a multi-select). If an array of search options is provided - type: string
then it must match all. - type: number
example: - type: boolean
arrayColumn: - type: object
- a - type: array
- b groups:
notContains: description: A grouping of filters to be applied.
type: object type: array
description: The logical inverse of contains. Only works on array column types. items:
If an array of values is passed, the row must not match any of type: object
them to be returned in the response. properties:
example: logicalOperator:
arrayColumn: description: When using groups this defines whether all of the filters must
- a match, or only one of them.
- b type: string
containsAny: enum:
type: object - all
description: As with the contains search, only works on array column types and - any
searches for any of the provided values when given an array. filters:
example: description: A list of filters to apply
arrayColumn: type: array
- a items:
- b type: object
properties:
operator:
type: string
description: The type of search operation which is being performed.
enum:
- equal
- notEqual
- empty
- notEmpty
- fuzzy
- string
- contains
- notContains
- containsAny
- oneOf
- range
field:
type: string
description: The field in the view to perform the search on.
value:
description: The value to search for - the type will depend on the operator in
use.
oneOf:
- type: string
- type: number
- type: boolean
- type: object
- type: array
sort: sort:
type: object type: object
required: required:
@ -1958,85 +2010,115 @@ components:
description: A column used to display rows from this view - usually used when description: A column used to display rows from this view - usually used when
rendered in tables. rendered in tables.
query: query:
description: Search parameters for view
type: object type: object
required: []
properties: properties:
allOr: logicalOperator:
type: boolean description: When using groups this defines whether all of the filters must
description: Specifies that a row should be returned if it satisfies any of the match, or only one of them.
specified options, rather than requiring it to fulfill all type: string
the search parameters. This defaults to false, meaning AND enum:
logic will be used. - all
string: - any
type: object onEmptyFilter:
example: description: If no filters match, should the view return all rows, or no rows.
columnName1: value type: string
columnName2: value enum:
description: A map of field name to the string to search for, this will look for - all
rows that have a value starting with the string value. - none
additionalProperties: groups:
type: string description: A grouping of filters to be applied.
description: The value to search for in the column. type: array
fuzzy: items:
type: object type: object
description: Searches for a sub-string within a string column, e.g. searching properties:
for 'dib' will match 'Budibase'. logicalOperator:
range: description: When using groups this defines whether all of the filters must
type: object match, or only one of them.
description: Searches within a range, the format of this must be in the format type: string
of an object with a "low" and "high" property. enum:
example: - all
columnName1: - any
low: 10 filters:
high: 20 description: A list of filters to apply
equal: type: array
type: object items:
description: Searches for rows that have a column value that is exactly the type: object
value set. properties:
notEqual: operator:
type: object type: string
description: Searches for any row which does not contain the specified column description: The type of search operation which is being performed.
value. enum:
empty: - equal
type: object - notEqual
description: Searches for rows which do not contain the specified column. The - empty
object should simply contain keys of the column names, these - notEmpty
can map to any value. - fuzzy
example: - string
columnName1: "" - contains
notEmpty: - notContains
type: object - containsAny
description: Searches for rows which have the specified column. - oneOf
oneOf: - range
type: object field:
description: Searches for rows which have a column value that is any of the type: string
specified values. The format of this must be columnName -> description: The field in the view to perform the search on.
[value1, value2]. value:
contains: description: The value to search for - the type will depend on the operator in
type: object use.
description: Searches for a value, or set of values in array column types (such oneOf:
as a multi-select). If an array of search options is - type: string
provided then it must match all. - type: number
example: - type: boolean
arrayColumn: - type: object
- a - type: array
- b groups:
notContains: description: A grouping of filters to be applied.
type: object type: array
description: The logical inverse of contains. Only works on array column types. items:
If an array of values is passed, the row must not match any type: object
of them to be returned in the response. properties:
example: logicalOperator:
arrayColumn: description: When using groups this defines whether all of the filters must
- a match, or only one of them.
- b type: string
containsAny: enum:
type: object - all
description: As with the contains search, only works on array column types and - any
searches for any of the provided values when given an array. filters:
example: description: A list of filters to apply
arrayColumn: type: array
- a items:
- b type: object
properties:
operator:
type: string
description: The type of search operation which is being performed.
enum:
- equal
- notEqual
- empty
- notEmpty
- fuzzy
- string
- contains
- notContains
- containsAny
- oneOf
- range
field:
type: string
description: The field in the view to perform the search on.
value:
description: The value to search for - the type will depend on the operator in
use.
oneOf:
- type: string
- type: number
- type: boolean
- type: object
- type: array
sort: sort:
type: object type: object
required: required:
@ -2145,86 +2227,115 @@ components:
description: A column used to display rows from this view - usually used when description: A column used to display rows from this view - usually used when
rendered in tables. rendered in tables.
query: query:
description: Search parameters for view
type: object type: object
required: []
properties: properties:
allOr: logicalOperator:
type: boolean description: When using groups this defines whether all of the filters must
description: Specifies that a row should be returned if it satisfies any of the match, or only one of them.
specified options, rather than requiring it to fulfill all type: string
the search parameters. This defaults to false, meaning AND enum:
logic will be used. - all
string: - any
type: object onEmptyFilter:
example: description: If no filters match, should the view return all rows, or no rows.
columnName1: value type: string
columnName2: value enum:
description: A map of field name to the string to search for, this will look for - all
rows that have a value starting with the string value. - none
additionalProperties: groups:
type: string description: A grouping of filters to be applied.
description: The value to search for in the column. type: array
fuzzy: items:
type: object type: object
description: Searches for a sub-string within a string column, e.g. searching properties:
for 'dib' will match 'Budibase'. logicalOperator:
range: description: When using groups this defines whether all of the filters must
type: object match, or only one of them.
description: Searches within a range, the format of this must be in the format type: string
of an object with a "low" and "high" property. enum:
example: - all
columnName1: - any
low: 10 filters:
high: 20 description: A list of filters to apply
equal: type: array
type: object items:
description: Searches for rows that have a column value that is exactly the type: object
value set. properties:
notEqual: operator:
type: object type: string
description: Searches for any row which does not contain the specified column description: The type of search operation which is being performed.
value. enum:
empty: - equal
type: object - notEqual
description: Searches for rows which do not contain the specified column. The - empty
object should simply contain keys of the column names, - notEmpty
these can map to any value. - fuzzy
example: - string
columnName1: "" - contains
notEmpty: - notContains
type: object - containsAny
description: Searches for rows which have the specified column. - oneOf
oneOf: - range
type: object field:
description: Searches for rows which have a column value that is any of the type: string
specified values. The format of this must be columnName -> description: The field in the view to perform the search on.
[value1, value2]. value:
contains: description: The value to search for - the type will depend on the operator in
type: object use.
description: Searches for a value, or set of values in array column types (such oneOf:
as a multi-select). If an array of search options is - type: string
provided then it must match all. - type: number
example: - type: boolean
arrayColumn: - type: object
- a - type: array
- b groups:
notContains: description: A grouping of filters to be applied.
type: object type: array
description: The logical inverse of contains. Only works on array column types. items:
If an array of values is passed, the row must not match type: object
any of them to be returned in the response. properties:
example: logicalOperator:
arrayColumn: description: When using groups this defines whether all of the filters must
- a match, or only one of them.
- b type: string
containsAny: enum:
type: object - all
description: As with the contains search, only works on array column types and - any
searches for any of the provided values when given an filters:
array. description: A list of filters to apply
example: type: array
arrayColumn: items:
- a type: object
- b properties:
operator:
type: string
description: The type of search operation which is being performed.
enum:
- equal
- notEqual
- empty
- notEmpty
- fuzzy
- string
- contains
- notContains
- containsAny
- oneOf
- range
field:
type: string
description: The field in the view to perform the search on.
value:
description: The value to search for - the type will depend on the operator in
use.
oneOf:
- type: string
- type: number
- type: boolean
- type: object
- type: array
sort: sort:
type: object type: object
required: required:

View File

@ -1,7 +1,14 @@
import { object } from "./utils" import { object } from "./utils"
import Resource from "./utils/Resource" import Resource from "./utils/Resource"
import { CalculationType, SortOrder, SortType } from "@budibase/types" import {
import { searchSchema } from "./misc" ArrayOperator,
BasicOperator,
CalculationType,
RangeOperator,
SortOrder,
SortType,
} from "@budibase/types"
import { cloneDeep } from "lodash"
const view = { const view = {
name: "peopleView", name: "peopleView",
@ -25,9 +32,17 @@ const view = {
}, },
}, },
query: { query: {
string: { logicalOperator: "all",
column: "value", onEmptyFilter: "none",
}, groups: [
{
logicalOperator: "any",
filters: [
{ operator: "string", field: "name", value: "John" },
{ operator: "range", field: "age", value: { low: 18, high: 100 } },
],
},
],
}, },
primaryDisplay: "name", primaryDisplay: "name",
} }
@ -68,6 +83,78 @@ const baseColumnDef = {
}, },
} }
const logicalOperator = {
description:
"When using groups this defines whether all of the filters must match, or only one of them.",
type: "string",
enum: ["all", "any"],
}
const filterGroup = {
description: "A grouping of filters to be applied.",
type: "array",
items: {
type: "object",
properties: {
logicalOperator,
filters: {
description: "A list of filters to apply",
type: "array",
items: {
type: "object",
properties: {
operator: {
type: "string",
description:
"The type of search operation which is being performed.",
enum: [
...Object.values(BasicOperator),
...Object.values(ArrayOperator),
...Object.values(RangeOperator),
],
},
field: {
type: "string",
description: "The field in the view to perform the search on.",
},
value: {
description:
"The value to search for - the type will depend on the operator in use.",
oneOf: [
{ type: "string" },
{ type: "number" },
{ type: "boolean" },
{ type: "object" },
{ type: "array" },
],
},
},
},
},
},
},
}
// have to clone to avoid constantly recursive structure - we can't represent this easily
const layeredFilterGroup: any = cloneDeep(filterGroup)
layeredFilterGroup.items.properties.groups = filterGroup
const viewQuerySchema = {
description: "Search parameters for view",
type: "object",
required: [],
properties: {
logicalOperator,
onEmptyFilter: {
description:
"If no filters match, should the view return all rows, or no rows.",
type: "string",
enum: ["all", "none"],
},
groups: layeredFilterGroup,
},
}
const viewSchema = { const viewSchema = {
description: "The view to be created/updated.", description: "The view to be created/updated.",
type: "object", type: "object",
@ -91,7 +178,7 @@ const viewSchema = {
description: description:
"A column used to display rows from this view - usually used when rendered in tables.", "A column used to display rows from this view - usually used when rendered in tables.",
}, },
query: searchSchema, query: viewQuerySchema,
sort: { sort: {
type: "object", type: "object",
required: ["field"], required: ["field"],

View File

@ -11,12 +11,10 @@ function fixView(view: ViewV2, params?: { viewId: string }) {
if (params?.viewId) { if (params?.viewId) {
view.id = params.viewId view.id = params.viewId
} }
if (!view.version) {
view.version = 2
}
if (!view.query) { if (!view.query) {
view.query = {} view.query = {}
} }
view.version = 2
return view return view
} }

View File

@ -96,6 +96,19 @@ export class PublicRowAPI {
this.request = request this.request = request
} }
async create(
tableId: string,
row: Row,
expectations?: PublicAPIExpectations
): Promise<Response<Row>> {
return this.request.send(
"post",
`/tables/${tableId}/rows`,
row,
expectations
)
}
async search( async search(
tableId: string, tableId: string,
query: SearchFilters, query: SearchFilters,

View File

@ -65,4 +65,26 @@ describe("check public API security", () => {
const result = await request.views.destroy(view.data.id, { status: 204 }) const result = await request.views.destroy(view.data.id, { status: 204 })
expect(result).toBeDefined() expect(result).toBeDefined()
}) })
it("should be able to search rows through a view", async () => {
const row1 = await request.rows.create(
table._id!,
{ name: "hello world" },
{ status: 200 }
)
await request.rows.create(table._id!, { name: "foo bar" }, { status: 200 })
const response = await request.views.create(
{
...baseView(),
query: {
string: {
name: "hello",
},
},
},
{ status: 201 }
)
const results = await request.rows.viewSearch(response.data.id, {})
expect(results.data.length).toEqual(1)
})
}) })

View File

@ -845,49 +845,90 @@ export interface components {
type?: "calculation"; type?: "calculation";
/** @description A column used to display rows from this view - usually used when rendered in tables. */ /** @description A column used to display rows from this view - usually used when rendered in tables. */
primaryDisplay?: string; primaryDisplay?: string;
/** @description Search parameters for view */
query?: { query?: {
/** @description Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used. */
allOr?: boolean;
/** /**
* @description A map of field name to the string to search for, this will look for rows that have a value starting with the string value. * @description When using groups this defines whether all of the filters must match, or only one of them.
* @example [object Object] * @enum {string}
*/ */
string?: { [key: string]: string }; logicalOperator?: "all" | "any";
/** @description Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'. */
fuzzy?: { [key: string]: unknown };
/** /**
* @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property. * @description If no filters match, should the view return all rows, or no rows.
* @example [object Object] * @enum {string}
*/ */
range?: { [key: string]: unknown }; onEmptyFilter?: "all" | "none";
/** @description Searches for rows that have a column value that is exactly the value set. */ /** @description A grouping of filters to be applied. */
equal?: { [key: string]: unknown }; groups?: {
/** @description Searches for any row which does not contain the specified column value. */ /**
notEqual?: { [key: string]: unknown }; * @description When using groups this defines whether all of the filters must match, or only one of them.
/** * @enum {string}
* @description Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value. */
* @example [object Object] logicalOperator?: "all" | "any";
*/ /** @description A list of filters to apply */
empty?: { [key: string]: unknown }; filters?: {
/** @description Searches for rows which have the specified column. */ /**
notEmpty?: { [key: string]: unknown }; * @description The type of search operation which is being performed.
/** @description Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]. */ * @enum {string}
oneOf?: { [key: string]: unknown }; */
/** operator?:
* @description Searches for a value, or set of values in array column types (such as a multi-select). If an array of search options is provided then it must match all. | "equal"
* @example [object Object] | "notEqual"
*/ | "empty"
contains?: { [key: string]: unknown }; | "notEmpty"
/** | "fuzzy"
* @description The logical inverse of contains. Only works on array column types. If an array of values is passed, the row must not match any of them to be returned in the response. | "string"
* @example [object Object] | "contains"
*/ | "notContains"
notContains?: { [key: string]: unknown }; | "containsAny"
/** | "oneOf"
* @description As with the contains search, only works on array column types and searches for any of the provided values when given an array. | "range";
* @example [object Object] /** @description The field in the view to perform the search on. */
*/ field?: string;
containsAny?: { [key: string]: unknown }; /** @description The value to search for - the type will depend on the operator in use. */
value?:
| string
| number
| boolean
| { [key: string]: unknown }
| unknown[];
}[];
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @description The type of search operation which is being performed.
* @enum {string}
*/
operator?:
| "equal"
| "notEqual"
| "empty"
| "notEmpty"
| "fuzzy"
| "string"
| "contains"
| "notContains"
| "containsAny"
| "oneOf"
| "range";
/** @description The field in the view to perform the search on. */
field?: string;
/** @description The value to search for - the type will depend on the operator in use. */
value?:
| string
| number
| boolean
| { [key: string]: unknown }
| unknown[];
}[];
}[];
}[];
}; };
sort?: { sort?: {
/** @description The field from the table/view schema to sort on. */ /** @description The field from the table/view schema to sort on. */
@ -946,49 +987,90 @@ export interface components {
type?: "calculation"; type?: "calculation";
/** @description A column used to display rows from this view - usually used when rendered in tables. */ /** @description A column used to display rows from this view - usually used when rendered in tables. */
primaryDisplay?: string; primaryDisplay?: string;
/** @description Search parameters for view */
query?: { query?: {
/** @description Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used. */
allOr?: boolean;
/** /**
* @description A map of field name to the string to search for, this will look for rows that have a value starting with the string value. * @description When using groups this defines whether all of the filters must match, or only one of them.
* @example [object Object] * @enum {string}
*/ */
string?: { [key: string]: string }; logicalOperator?: "all" | "any";
/** @description Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'. */
fuzzy?: { [key: string]: unknown };
/** /**
* @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property. * @description If no filters match, should the view return all rows, or no rows.
* @example [object Object] * @enum {string}
*/ */
range?: { [key: string]: unknown }; onEmptyFilter?: "all" | "none";
/** @description Searches for rows that have a column value that is exactly the value set. */ /** @description A grouping of filters to be applied. */
equal?: { [key: string]: unknown }; groups?: {
/** @description Searches for any row which does not contain the specified column value. */ /**
notEqual?: { [key: string]: unknown }; * @description When using groups this defines whether all of the filters must match, or only one of them.
/** * @enum {string}
* @description Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value. */
* @example [object Object] logicalOperator?: "all" | "any";
*/ /** @description A list of filters to apply */
empty?: { [key: string]: unknown }; filters?: {
/** @description Searches for rows which have the specified column. */ /**
notEmpty?: { [key: string]: unknown }; * @description The type of search operation which is being performed.
/** @description Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]. */ * @enum {string}
oneOf?: { [key: string]: unknown }; */
/** operator?:
* @description Searches for a value, or set of values in array column types (such as a multi-select). If an array of search options is provided then it must match all. | "equal"
* @example [object Object] | "notEqual"
*/ | "empty"
contains?: { [key: string]: unknown }; | "notEmpty"
/** | "fuzzy"
* @description The logical inverse of contains. Only works on array column types. If an array of values is passed, the row must not match any of them to be returned in the response. | "string"
* @example [object Object] | "contains"
*/ | "notContains"
notContains?: { [key: string]: unknown }; | "containsAny"
/** | "oneOf"
* @description As with the contains search, only works on array column types and searches for any of the provided values when given an array. | "range";
* @example [object Object] /** @description The field in the view to perform the search on. */
*/ field?: string;
containsAny?: { [key: string]: unknown }; /** @description The value to search for - the type will depend on the operator in use. */
value?:
| string
| number
| boolean
| { [key: string]: unknown }
| unknown[];
}[];
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @description The type of search operation which is being performed.
* @enum {string}
*/
operator?:
| "equal"
| "notEqual"
| "empty"
| "notEmpty"
| "fuzzy"
| "string"
| "contains"
| "notContains"
| "containsAny"
| "oneOf"
| "range";
/** @description The field in the view to perform the search on. */
field?: string;
/** @description The value to search for - the type will depend on the operator in use. */
value?:
| string
| number
| boolean
| { [key: string]: unknown }
| unknown[];
}[];
}[];
}[];
}; };
sort?: { sort?: {
/** @description The field from the table/view schema to sort on. */ /** @description The field from the table/view schema to sort on. */
@ -1049,49 +1131,90 @@ export interface components {
type?: "calculation"; type?: "calculation";
/** @description A column used to display rows from this view - usually used when rendered in tables. */ /** @description A column used to display rows from this view - usually used when rendered in tables. */
primaryDisplay?: string; primaryDisplay?: string;
/** @description Search parameters for view */
query?: { query?: {
/** @description Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used. */
allOr?: boolean;
/** /**
* @description A map of field name to the string to search for, this will look for rows that have a value starting with the string value. * @description When using groups this defines whether all of the filters must match, or only one of them.
* @example [object Object] * @enum {string}
*/ */
string?: { [key: string]: string }; logicalOperator?: "all" | "any";
/** @description Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'. */
fuzzy?: { [key: string]: unknown };
/** /**
* @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property. * @description If no filters match, should the view return all rows, or no rows.
* @example [object Object] * @enum {string}
*/ */
range?: { [key: string]: unknown }; onEmptyFilter?: "all" | "none";
/** @description Searches for rows that have a column value that is exactly the value set. */ /** @description A grouping of filters to be applied. */
equal?: { [key: string]: unknown }; groups?: {
/** @description Searches for any row which does not contain the specified column value. */ /**
notEqual?: { [key: string]: unknown }; * @description When using groups this defines whether all of the filters must match, or only one of them.
/** * @enum {string}
* @description Searches for rows which do not contain the specified column. The object should simply contain keys of the column names, these can map to any value. */
* @example [object Object] logicalOperator?: "all" | "any";
*/ /** @description A list of filters to apply */
empty?: { [key: string]: unknown }; filters?: {
/** @description Searches for rows which have the specified column. */ /**
notEmpty?: { [key: string]: unknown }; * @description The type of search operation which is being performed.
/** @description Searches for rows which have a column value that is any of the specified values. The format of this must be columnName -> [value1, value2]. */ * @enum {string}
oneOf?: { [key: string]: unknown }; */
/** operator?:
* @description Searches for a value, or set of values in array column types (such as a multi-select). If an array of search options is provided then it must match all. | "equal"
* @example [object Object] | "notEqual"
*/ | "empty"
contains?: { [key: string]: unknown }; | "notEmpty"
/** | "fuzzy"
* @description The logical inverse of contains. Only works on array column types. If an array of values is passed, the row must not match any of them to be returned in the response. | "string"
* @example [object Object] | "contains"
*/ | "notContains"
notContains?: { [key: string]: unknown }; | "containsAny"
/** | "oneOf"
* @description As with the contains search, only works on array column types and searches for any of the provided values when given an array. | "range";
* @example [object Object] /** @description The field in the view to perform the search on. */
*/ field?: string;
containsAny?: { [key: string]: unknown }; /** @description The value to search for - the type will depend on the operator in use. */
value?:
| string
| number
| boolean
| { [key: string]: unknown }
| unknown[];
}[];
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @description The type of search operation which is being performed.
* @enum {string}
*/
operator?:
| "equal"
| "notEqual"
| "empty"
| "notEmpty"
| "fuzzy"
| "string"
| "contains"
| "notContains"
| "containsAny"
| "oneOf"
| "range";
/** @description The field in the view to perform the search on. */
field?: string;
/** @description The value to search for - the type will depend on the operator in use. */
value?:
| string
| number
| boolean
| { [key: string]: unknown }
| unknown[];
}[];
}[];
}[];
}; };
sort?: { sort?: {
/** @description The field from the table/view schema to sort on. */ /** @description The field from the table/view schema to sort on. */