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": {
"string": {
"column": "value"
"logicalOperator": "all",
"onEmptyFilter": "none",
"groups": [
{
"logicalOperator": "any",
"filters": [
{
"operator": "string",
"field": "name",
"value": "John"
},
{
"operator": "range",
"field": "age",
"value": {
"low": 18,
"high": 100
}
}
]
}
]
},
"primaryDisplay": "name"
}
@ -490,9 +509,28 @@
}
},
"query": {
"string": {
"column": "value"
"logicalOperator": "all",
"onEmptyFilter": "none",
"groups": [
{
"logicalOperator": "any",
"filters": [
{
"operator": "string",
"field": "name",
"value": "John"
},
{
"operator": "range",
"field": "age",
"value": {
"low": 18,
"high": 100
}
}
]
}
]
},
"primaryDisplay": "name"
}
@ -2126,89 +2164,158 @@
"description": "A column used to display rows from this view - usually used when rendered in tables."
},
"query": {
"description": "Search parameters for view",
"type": "object",
"required": [],
"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"
]
},
"onEmptyFilter": {
"description": "If no filters match, should the view return all rows, or no rows.",
"type": "string",
"enum": [
"all",
"none"
]
},
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"type": "object",
"properties": {
"allOr": {
"type": "boolean",
"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."
},
"string": {
"type": "object",
"example": {
"columnName1": "value",
"columnName2": "value"
},
"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": {
"logicalOperator": {
"description": "When using groups this defines whether all of the filters must match, or only one of them.",
"type": "string",
"description": "The value to search for in the column."
"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"
}
},
"fuzzy": {
"type": "object",
"description": "Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'."
},
"range": {
"type": "object",
"description": "Searches within a range, the format of this must be in the format of an object with a \"low\" and \"high\" property.",
"example": {
"columnName1": {
"low": 10,
"high": 20
}
}
},
"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": {
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"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"
"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"
}
]
}
}
}
}
}
}
}
}
}
}
}
@ -2340,89 +2447,158 @@
"description": "A column used to display rows from this view - usually used when rendered in tables."
},
"query": {
"description": "Search parameters for view",
"type": "object",
"required": [],
"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"
]
},
"onEmptyFilter": {
"description": "If no filters match, should the view return all rows, or no rows.",
"type": "string",
"enum": [
"all",
"none"
]
},
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"type": "object",
"properties": {
"allOr": {
"type": "boolean",
"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."
},
"string": {
"type": "object",
"example": {
"columnName1": "value",
"columnName2": "value"
},
"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": {
"logicalOperator": {
"description": "When using groups this defines whether all of the filters must match, or only one of them.",
"type": "string",
"description": "The value to search for in the column."
"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"
}
},
"fuzzy": {
"type": "object",
"description": "Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'."
},
"range": {
"type": "object",
"description": "Searches within a range, the format of this must be in the format of an object with a \"low\" and \"high\" property.",
"example": {
"columnName1": {
"low": 10,
"high": 20
}
}
},
"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": {
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"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"
"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"
}
]
}
}
}
}
}
}
}
}
}
}
}
@ -2565,89 +2741,158 @@
"description": "A column used to display rows from this view - usually used when rendered in tables."
},
"query": {
"description": "Search parameters for view",
"type": "object",
"required": [],
"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"
]
},
"onEmptyFilter": {
"description": "If no filters match, should the view return all rows, or no rows.",
"type": "string",
"enum": [
"all",
"none"
]
},
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"type": "object",
"properties": {
"allOr": {
"type": "boolean",
"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."
},
"string": {
"type": "object",
"example": {
"columnName1": "value",
"columnName2": "value"
},
"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": {
"logicalOperator": {
"description": "When using groups this defines whether all of the filters must match, or only one of them.",
"type": "string",
"description": "The value to search for in the column."
"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"
}
},
"fuzzy": {
"type": "object",
"description": "Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'."
},
"range": {
"type": "object",
"description": "Searches within a range, the format of this must be in the format of an object with a \"low\" and \"high\" property.",
"example": {
"columnName1": {
"low": 10,
"high": 20
}
}
},
"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": {
"groups": {
"description": "A grouping of filters to be applied.",
"type": "array",
"items": {
"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"
"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"
}
]
}
}
}
}
}
}
}
}
}
}
}

View File

@ -469,8 +469,19 @@ components:
visible: false
readonly: false
query:
string:
column: value
logicalOperator: all
onEmptyFilter: none
groups:
- logicalOperator: any
filters:
- operator: string
field: name
value: John
- operator: range
field: age
value:
low: 18
high: 100
primaryDisplay: name
views:
value:
@ -492,8 +503,19 @@ components:
visible: false
readonly: false
query:
string:
column: value
logicalOperator: all
onEmptyFilter: none
groups:
- logicalOperator: any
filters:
- operator: string
field: name
value: John
- operator: range
field: age
value:
low: 18
high: 100
primaryDisplay: name
securitySchemes:
ApiKeyAuth:
@ -1778,85 +1800,115 @@ components:
description: A column used to display rows from this view - usually used when
rendered in tables.
query:
description: Search parameters for view
type: object
required: []
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
onEmptyFilter:
description: If no filters match, should the view return all rows, or no rows.
type: string
enum:
- all
- none
groups:
description: A grouping of filters to be applied.
type: array
items:
type: object
properties:
allOr:
type: boolean
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.
string:
type: object
example:
columnName1: value
columnName2: value
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:
logicalOperator:
description: When using groups this defines whether all of the filters must
match, or only one of them.
type: string
description: The value to search for in the column.
fuzzy:
enum:
- all
- any
filters:
description: A list of filters to apply
type: array
items:
type: object
description: Searches for a sub-string within a string column, e.g. searching
for 'dib' will match 'Budibase'.
range:
type: object
description: Searches within a range, the format of this must be in the format
of an object with a "low" and "high" property.
example:
columnName1:
low: 10
high: 20
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.
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
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:
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
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
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:
type: object
required:
@ -1958,85 +2010,115 @@ components:
description: A column used to display rows from this view - usually used when
rendered in tables.
query:
description: Search parameters for view
type: object
required: []
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
onEmptyFilter:
description: If no filters match, should the view return all rows, or no rows.
type: string
enum:
- all
- none
groups:
description: A grouping of filters to be applied.
type: array
items:
type: object
properties:
allOr:
type: boolean
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.
string:
type: object
example:
columnName1: value
columnName2: value
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:
logicalOperator:
description: When using groups this defines whether all of the filters must
match, or only one of them.
type: string
description: The value to search for in the column.
fuzzy:
enum:
- all
- any
filters:
description: A list of filters to apply
type: array
items:
type: object
description: Searches for a sub-string within a string column, e.g. searching
for 'dib' will match 'Budibase'.
range:
type: object
description: Searches within a range, the format of this must be in the format
of an object with a "low" and "high" property.
example:
columnName1:
low: 10
high: 20
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.
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
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:
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
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
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:
type: object
required:
@ -2145,86 +2227,115 @@ components:
description: A column used to display rows from this view - usually used when
rendered in tables.
query:
description: Search parameters for view
type: object
required: []
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
onEmptyFilter:
description: If no filters match, should the view return all rows, or no rows.
type: string
enum:
- all
- none
groups:
description: A grouping of filters to be applied.
type: array
items:
type: object
properties:
allOr:
type: boolean
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.
string:
type: object
example:
columnName1: value
columnName2: value
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:
logicalOperator:
description: When using groups this defines whether all of the filters must
match, or only one of them.
type: string
description: The value to search for in the column.
fuzzy:
enum:
- all
- any
filters:
description: A list of filters to apply
type: array
items:
type: object
description: Searches for a sub-string within a string column, e.g. searching
for 'dib' will match 'Budibase'.
range:
type: object
description: Searches within a range, the format of this must be in the format
of an object with a "low" and "high" property.
example:
columnName1:
low: 10
high: 20
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.
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
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:
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
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
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:
type: object
required:

View File

@ -1,7 +1,14 @@
import { object } from "./utils"
import Resource from "./utils/Resource"
import { CalculationType, SortOrder, SortType } from "@budibase/types"
import { searchSchema } from "./misc"
import {
ArrayOperator,
BasicOperator,
CalculationType,
RangeOperator,
SortOrder,
SortType,
} from "@budibase/types"
import { cloneDeep } from "lodash"
const view = {
name: "peopleView",
@ -25,9 +32,17 @@ const view = {
},
},
query: {
string: {
column: "value",
logicalOperator: "all",
onEmptyFilter: "none",
groups: [
{
logicalOperator: "any",
filters: [
{ operator: "string", field: "name", value: "John" },
{ operator: "range", field: "age", value: { low: 18, high: 100 } },
],
},
],
},
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 = {
description: "The view to be created/updated.",
type: "object",
@ -91,7 +178,7 @@ const viewSchema = {
description:
"A column used to display rows from this view - usually used when rendered in tables.",
},
query: searchSchema,
query: viewQuerySchema,
sort: {
type: "object",
required: ["field"],

View File

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

View File

@ -96,6 +96,19 @@ export class PublicRowAPI {
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(
tableId: string,
query: SearchFilters,

View File

@ -65,4 +65,26 @@ describe("check public API security", () => {
const result = await request.views.destroy(view.data.id, { status: 204 })
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";
/** @description A column used to display rows from this view - usually used when rendered in tables. */
primaryDisplay?: string;
/** @description Search parameters for view */
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.
* @example [object Object]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
string?: { [key: string]: string };
/** @description Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'. */
fuzzy?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/**
* @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property.
* @example [object Object]
* @description If no filters match, should the view return all rows, or no rows.
* @enum {string}
*/
range?: { [key: string]: unknown };
/** @description Searches for rows that have a column value that is exactly the value set. */
equal?: { [key: string]: unknown };
/** @description Searches for any row which does not contain the specified column value. */
notEqual?: { [key: string]: unknown };
onEmptyFilter?: "all" | "none";
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @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]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
empty?: { [key: string]: unknown };
/** @description Searches for rows which have the specified column. */
notEmpty?: { [key: string]: unknown };
/** @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]. */
oneOf?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @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 [object Object]
* @description The type of search operation which is being performed.
* @enum {string}
*/
contains?: { [key: string]: unknown };
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[];
}[];
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @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 [object Object]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
notContains?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @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 [object Object]
* @description The type of search operation which is being performed.
* @enum {string}
*/
containsAny?: { [key: string]: unknown };
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?: {
/** @description The field from the table/view schema to sort on. */
@ -946,49 +987,90 @@ export interface components {
type?: "calculation";
/** @description A column used to display rows from this view - usually used when rendered in tables. */
primaryDisplay?: string;
/** @description Search parameters for view */
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.
* @example [object Object]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
string?: { [key: string]: string };
/** @description Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'. */
fuzzy?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/**
* @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property.
* @example [object Object]
* @description If no filters match, should the view return all rows, or no rows.
* @enum {string}
*/
range?: { [key: string]: unknown };
/** @description Searches for rows that have a column value that is exactly the value set. */
equal?: { [key: string]: unknown };
/** @description Searches for any row which does not contain the specified column value. */
notEqual?: { [key: string]: unknown };
onEmptyFilter?: "all" | "none";
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @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]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
empty?: { [key: string]: unknown };
/** @description Searches for rows which have the specified column. */
notEmpty?: { [key: string]: unknown };
/** @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]. */
oneOf?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @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 [object Object]
* @description The type of search operation which is being performed.
* @enum {string}
*/
contains?: { [key: string]: unknown };
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[];
}[];
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @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 [object Object]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
notContains?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @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 [object Object]
* @description The type of search operation which is being performed.
* @enum {string}
*/
containsAny?: { [key: string]: unknown };
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?: {
/** @description The field from the table/view schema to sort on. */
@ -1049,49 +1131,90 @@ export interface components {
type?: "calculation";
/** @description A column used to display rows from this view - usually used when rendered in tables. */
primaryDisplay?: string;
/** @description Search parameters for view */
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.
* @example [object Object]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
string?: { [key: string]: string };
/** @description Searches for a sub-string within a string column, e.g. searching for 'dib' will match 'Budibase'. */
fuzzy?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/**
* @description Searches within a range, the format of this must be in the format of an object with a "low" and "high" property.
* @example [object Object]
* @description If no filters match, should the view return all rows, or no rows.
* @enum {string}
*/
range?: { [key: string]: unknown };
/** @description Searches for rows that have a column value that is exactly the value set. */
equal?: { [key: string]: unknown };
/** @description Searches for any row which does not contain the specified column value. */
notEqual?: { [key: string]: unknown };
onEmptyFilter?: "all" | "none";
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @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]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
empty?: { [key: string]: unknown };
/** @description Searches for rows which have the specified column. */
notEmpty?: { [key: string]: unknown };
/** @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]. */
oneOf?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @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 [object Object]
* @description The type of search operation which is being performed.
* @enum {string}
*/
contains?: { [key: string]: unknown };
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[];
}[];
/** @description A grouping of filters to be applied. */
groups?: {
/**
* @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 [object Object]
* @description When using groups this defines whether all of the filters must match, or only one of them.
* @enum {string}
*/
notContains?: { [key: string]: unknown };
logicalOperator?: "all" | "any";
/** @description A list of filters to apply */
filters?: {
/**
* @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 [object Object]
* @description The type of search operation which is being performed.
* @enum {string}
*/
containsAny?: { [key: string]: unknown };
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?: {
/** @description The field from the table/view schema to sort on. */