Skip to content

Commit

Permalink
Update reference agent
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-chambers committed Oct 17, 2024
1 parent 5f15a31 commit d46767e
Show file tree
Hide file tree
Showing 6 changed files with 338 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ndc-models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ pub enum Expression {
// ANCHOR: ArrayComparison
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
#[schemars(title = "Array Comparison")]
#[serde(rename_all = "snake_case")]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ArrayComparison {
/// Check if the array contains the specified value
Contains { value: ComparisonValue },
Expand Down
58 changes: 57 additions & 1 deletion ndc-models/tests/json_schema/capabilities_response.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"description": "Does the connector support filtering by values of nested fields",
"anyOf": [
{
"$ref": "#/definitions/LeafCapability"
"$ref": "#/definitions/NestedFieldFilterByCapabilities"
},
{
"type": "null"
Expand Down Expand Up @@ -220,6 +220,62 @@
}
}
},
"NestedFieldFilterByCapabilities": {
"title": "Nested Field Filter By Capabilities",
"type": "object",
"properties": {
"nested_arrays": {
"description": "Does the connector support filtering over nested arrays",
"anyOf": [
{
"$ref": "#/definitions/NestedArrayFilterByCapabilities"
},
{
"type": "null"
}
]
}
}
},
"NestedArrayFilterByCapabilities": {
"title": "Nested Array Filter By Capabilities",
"type": "object",
"properties": {
"exists": {
"description": "Does the connector support filtering over nested arrays using existential quantification. This means the connector must support ExistsInCollection::NestedScalarCollection.",
"anyOf": [
{
"$ref": "#/definitions/LeafCapability"
},
{
"type": "null"
}
]
},
"contains": {
"description": "Does the connector support filtering over nested arrays by checking if the array contains a value. This must be supported for all types that can be contained in an array that implement an 'eq' comparison operator.",
"anyOf": [
{
"$ref": "#/definitions/LeafCapability"
},
{
"type": "null"
}
]
},
"is_empty": {
"description": "Does the connector support filtering over nested arrays by checking if the array is empty. This must be supported no matter what type is contained in the array.",
"anyOf": [
{
"$ref": "#/definitions/LeafCapability"
},
{
"type": "null"
}
]
}
}
},
"ExistsCapabilities": {
"title": "Exists Capabilities",
"type": "object",
Expand Down
93 changes: 93 additions & 0 deletions ndc-models/tests/json_schema/mutation_request.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,28 @@
}
}
},
{
"type": "object",
"required": [
"column",
"comparison",
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"array_comparison"
]
},
"column": {
"$ref": "#/definitions/ComparisonTarget"
},
"comparison": {
"$ref": "#/definitions/ArrayComparison"
}
}
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -942,6 +964,45 @@
}
]
},
"ArrayComparison": {
"title": "Array Comparison",
"oneOf": [
{
"description": "Check if the array contains the specified value",
"type": "object",
"required": [
"type",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"contains"
]
},
"value": {
"$ref": "#/definitions/ComparisonValue"
}
}
},
{
"description": "Check is the array is empty",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"is_empty"
]
}
}
}
]
},
"ExistsInCollection": {
"title": "Exists In Collection",
"oneOf": [
Expand Down Expand Up @@ -1028,6 +1089,38 @@
}
}
}
},
{
"description": "Specifies a column that contains a nested array of scalars. The array will be brought into scope of the nested expression where each element becomes an object with one '__value' column that contains the element value.",
"type": "object",
"required": [
"column_name",
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"nested_scalar_collection"
]
},
"column_name": {
"type": "string"
},
"arguments": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Argument"
}
},
"field_path": {
"description": "Path to a nested collection via object columns",
"type": "array",
"items": {
"type": "string"
}
}
}
}
]
},
Expand Down
93 changes: 93 additions & 0 deletions ndc-models/tests/json_schema/query_request.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,28 @@
}
}
},
{
"type": "object",
"required": [
"column",
"comparison",
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"array_comparison"
]
},
"column": {
"$ref": "#/definitions/ComparisonTarget"
},
"comparison": {
"$ref": "#/definitions/ArrayComparison"
}
}
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -927,6 +949,45 @@
}
]
},
"ArrayComparison": {
"title": "Array Comparison",
"oneOf": [
{
"description": "Check if the array contains the specified value",
"type": "object",
"required": [
"type",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"contains"
]
},
"value": {
"$ref": "#/definitions/ComparisonValue"
}
}
},
{
"description": "Check is the array is empty",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"is_empty"
]
}
}
}
]
},
"ExistsInCollection": {
"title": "Exists In Collection",
"oneOf": [
Expand Down Expand Up @@ -1013,6 +1074,38 @@
}
}
}
},
{
"description": "Specifies a column that contains a nested array of scalars. The array will be brought into scope of the nested expression where each element becomes an object with one '__value' column that contains the element value.",
"type": "object",
"required": [
"column_name",
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"nested_scalar_collection"
]
},
"column_name": {
"type": "string"
},
"arguments": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Argument"
}
},
"field_path": {
"description": "Path to a nested collection via object columns",
"type": "array",
"items": {
"type": "string"
}
}
}
}
]
},
Expand Down
Loading

0 comments on commit d46767e

Please sign in to comment.