From c852705d6c5e359c69bd96f61b01b3d59f544e10 Mon Sep 17 00:00:00 2001 From: Erik Seglem Date: Sat, 25 Feb 2023 10:59:50 -0500 Subject: [PATCH] Clean up minor inconsistencies in cql2 schemas. --- cql2/standard/schema/cql2.json | 69 ++++++++++++++-------------------- cql2/standard/schema/cql2.yml | 29 +++++++++----- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/cql2/standard/schema/cql2.json b/cql2/standard/schema/cql2.json index 89a7ce83..b2945c0d 100644 --- a/cql2/standard/schema/cql2.json +++ b/cql2/standard/schema/cql2.json @@ -101,14 +101,9 @@ "type": "array", "minItems": 2, "maxItems": 2, - "prefixItems": [ - { - "$ref": "#/$defs/scalarExpression" - }, - { - "$ref": "#/$defs/scalarExpression" - } - ] + "items": { + "$ref": "#/$defs/scalarExpression" + } }, "scalarExpression": { @@ -156,16 +151,17 @@ } }, "isLikeOperands": { - "type": "array", - "prefixItems": [ - { - "$ref": "#/$defs/characterExpression" - }, - { - "$ref": "#/$defs/patternExpression" - } - ], - "additionalItems": false + "type": "array", + "minItems": 2, + "maxItems": 2, + "prefixItems": [ + { + "$ref": "#/$defs/characterExpression" + }, + { + "$ref": "#/$defs/patternExpression" + } + ] }, "patternExpression": { @@ -248,6 +244,8 @@ }, "inListOperands": { "type": "array", + "minItems": 2, + "maxItems": 2, "prefixItems": [ { "$ref": "#/$defs/scalarExpression" @@ -258,8 +256,7 @@ "$ref": "#/$defs/scalarExpression" } } - ], - "additionalItems": false + ] }, "isNullPredicate": { @@ -319,15 +316,11 @@ }, "spatialOperands": { "type": "array", - "prefixItems": [ - { - "$ref": "#/$defs/geomExpression" - }, - { - "$ref": "#/$defs/geomExpression" - } - ], - "additionalItems": false + "minItems": 2, + "maxItems": 2, + "items": { + "$ref": "#/$defs/geomExpression" + } }, "geomExpression": { "oneOf": [ @@ -374,15 +367,11 @@ }, "temporalOperands": { "type": "array", - "prefixItems": [ - { - "$ref": "#/$defs/temporalExpression" - }, - { - "$ref": "#/$defs/temporalExpression" - } - ], - "additionalItems": false + "minItems": 2, + "maxItems": 2, + "items": { + "$ref": "#/$defs/temporalExpression" + } }, "temporalExpression": { "oneOf": [ @@ -466,7 +455,7 @@ "properties": { "op": { "type": "string", - "enum": [ "+", "-", "*", "/", "^" ] + "enum": [ "+", "-", "*", "/", "^", "%", "div" ] }, "args": { "$ref": "#/$defs/arithmeticOperands" @@ -582,7 +571,7 @@ "$ref": "#/$defs/temporalExpression" }, { - "$ref": "#/$defs/arrayLiteral" + "$ref": "#/$defs/arrayExpression" } ] } diff --git a/cql2/standard/schema/cql2.yml b/cql2/standard/schema/cql2.yml index dc18253f..d3757f53 100644 --- a/cql2/standard/schema/cql2.yml +++ b/cql2/standard/schema/cql2.yml @@ -65,12 +65,12 @@ components: op: type: string enum: - - = - - < - - > + - '=' + - '<>' + - '<' + - '>' - '<=' - '>=' - - <> args: $ref: '#/components/schemas/scalarOperands' scalarOperands: @@ -107,9 +107,12 @@ components: minItems: 2 maxItems: 2 items: - # The second argument is a string or a CASEI or - # ACCENTI call with a str. - $ref: '#/components/schemas/characterExpression' + oneOf: + - $ref: '#/components/schemas/characterExpression' + - $ref: '#/components/schemas/patternExpression' + description: >- + The first argument is a characterExpression and the second item + is a patternExpression. patternExpression: oneOf: - type: object @@ -163,13 +166,17 @@ components: $ref: '#/components/schemas/inListOperands' inListOperands: type: array + minItems: 2 + maxItems: 2 items: - # the first item is always a scalarExpression, the second an array oneOf: - $ref: '#/components/schemas/scalarExpression' - type: array items: $ref: '#/components/schemas/scalarExpression' + description: >- + The first item is a scalarExpression and the second item is an array + of scalarExpression. isNullPredicate: type: object required: @@ -299,11 +306,13 @@ components: op: type: string enum: - - + + - '+' - '-' - '*' - - / + - '/' - '^' + - '%' + - 'div' args: $ref: '#/components/schemas/arithmeticOperands' arithmeticOperands: