From 38d35e23ddb1e57da78cfb64db711b69253b7d49 Mon Sep 17 00:00:00 2001 From: Noah Overcash Date: Fri, 31 Jan 2025 18:33:50 -0500 Subject: [PATCH] [FQTM-11] New entity type join model --- pom.xml | 8 ++- src/main/resources/swagger.api/queryTool.yaml | 17 +++++ .../swagger.api/schemas/entityType.json | 10 +-- .../swagger.api/schemas/entityTypeColumn.json | 13 +++- .../swagger.api/schemas/entityTypeSource.json | 62 ++++++++----------- .../schemas/entityTypeSourceJoin.json | 24 ------- 6 files changed, 61 insertions(+), 73 deletions(-) delete mode 100644 src/main/resources/swagger.api/schemas/entityTypeSourceJoin.json diff --git a/pom.xml b/pom.xml index 237c41c..db8227d 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.folio folio-query-tool-metadata - 3.1.0-SNAPSHOT + 27.0.0 folio-query-tool-metadata This is a library (jar) that provides the SPI for used by the Query tool and must be implemented by a data provider, @@ -18,7 +18,7 @@ 17 - 7.3.0 + 7.11.0 3.8.7 ${project.basedir}/src/main/resources/swagger.api/queryTool.yaml 1.18.24 @@ -200,7 +200,9 @@ ,errors,error,parameters,parameter,resultsetPage, - ,entityType,field,entityTypeColumn,entityTypeRelation,entityTypeDefaultSort,sourceColumn,entityTypeSource,entityTypeSourceJoin, + ,entityType,field,entityTypeColumn,entityTypeRelation,entityTypeDefaultSort,sourceColumn, + ,entityTypeSource,entityTypeSourceBase,entityTypeSourceDatabase,entityTypeSourceDatabaseJoin,entityTypeSourceEntityType, + ,join,joinCustom,joinEqualitySimple,joinEqualityCastUUID, ,entityDataType,arrayType,jsonbArrayType,dateType,objectType,enumType,booleanType,integerType,openUUIDType,stringType,numberType,rangedUUIDType,stringUUIDType, ,nestedObjectProperty,valueWithLabel,valueSourceApi,columnValues,columnValueGetter ,queryDetails,queryIdentifier, diff --git a/src/main/resources/swagger.api/queryTool.yaml b/src/main/resources/swagger.api/queryTool.yaml index f93fe4a..cfcb97d 100644 --- a/src/main/resources/swagger.api/queryTool.yaml +++ b/src/main/resources/swagger.api/queryTool.yaml @@ -326,6 +326,14 @@ components: schemas: UUID: $ref: schemas/common.json#/UUID + + entityTypeSource: + $ref: schemas/entityTypeSource.json + entityTypeSourceDatabase: + $ref: schemas/entityTypeSourceDatabase.json + entityTypeSourceEntityType: + $ref: schemas/entityTypeSourceEntityType.json + entityType: $ref: schemas/entityType.json#/EntityType entityDataType: @@ -386,6 +394,15 @@ components: fqmMigrateResponse: $ref: schemas/fqmMigrateResponse.json + join: + $ref: schemas/field-joins/join.json + joinCustom: + $ref: schemas/field-joins/joinCustom.json + joinEqualitySimple: + $ref: schemas/field-joins/joinEqualitySimple.json + joinEqualityCastUUID: + $ref: schemas/field-joins/joinEqualityCastUUID.json + queryResultIds: type: array items: diff --git a/src/main/resources/swagger.api/schemas/entityType.json b/src/main/resources/swagger.api/schemas/entityType.json index abe1015..4945031 100644 --- a/src/main/resources/swagger.api/schemas/entityType.json +++ b/src/main/resources/swagger.api/schemas/entityType.json @@ -81,7 +81,7 @@ "sources": { "type": "array", "items": { - "$ref": "entityTypeSource.json" + "$ref": "./entityTypeSource.json" }, "default": [] }, @@ -102,12 +102,6 @@ "default": [] } }, - "required": [ - "id", - "name", - "root", - "private" - ] + "required": ["id", "name", "root", "private"] } } - diff --git a/src/main/resources/swagger.api/schemas/entityTypeColumn.json b/src/main/resources/swagger.api/schemas/entityTypeColumn.json index 8261c71..cf7d183 100644 --- a/src/main/resources/swagger.api/schemas/entityTypeColumn.json +++ b/src/main/resources/swagger.api/schemas/entityTypeColumn.json @@ -33,10 +33,21 @@ "essential": { "description": "Indicates if a column is crucial to the definition of an entity type", "type": "boolean" + }, + "joinsTo": { + "description": "A set of columns which this column may be joined to", + "type": "array", + "items": { + "$ref": "./field-joins/join.json" + } + }, + "originalEntityTypeId": { + "description": "[Internal only, not for definitions] The simplest entity type that this column is derived from", + "type": "string", + "format": "uuid" } }, "required": [] } ] } - diff --git a/src/main/resources/swagger.api/schemas/entityTypeSource.json b/src/main/resources/swagger.api/schemas/entityTypeSource.json index 001a5f0..85d743d 100644 --- a/src/main/resources/swagger.api/schemas/entityTypeSource.json +++ b/src/main/resources/swagger.api/schemas/entityTypeSource.json @@ -2,43 +2,31 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Entity Type Source", "description": "Definition for an entity type source, which provide a set of fields and can be joined with other sources", - "type": "object", - "properties": { - "type": { - "description": "Type of source. Valid values are db, entity-type.", - "type": "string" - }, - "target": { - "description": "Target from which values are extracted", - "type": "string" - }, - "alias": { - "description": "Alias of this source to be used in query", - "type": "string" - }, - "id": { - "description": "Id of the entity type for this source (entity-type type only)", - "type": "string" - }, - "join": { - "description": "Object describing how this entity type source can be joined to another source", - "$ref": "entityTypeSourceJoin.json" - }, - "flattened": { - "description": "Whether this source has already been flattened", - "type": "boolean" - }, - "useIdColumns": { - "description": "Whether to use the idColumns of this source as idColumns for the enclosing entity type", - "type": "boolean" - }, - "essentialOnly": { - "description": "Indicates that only critical columns for core functionality should be inherited, excluding non-essential columns", - "type": "boolean" + "allOf": [ + { + "type": "object", + "discriminator": { + "propertyName": "type", + "mapping": { + "db": "#/components/schemas/entityTypeSourceDatabase", + "entity-type": "#/components/schemas/entityTypeSourceEntityType" + } + }, + "properties": { + "type": { + "description": "Type of source. Valid values are db, entity-type", + "type": "string" + }, + "alias": { + "description": "Alias of this source to be used in query/later joins", + "type": "string" + }, + "joinedViaEntityType": { + "description": "[Internal use only, should not be included in definitions] The owning entity's alias, if this source's joining is handled by a parent entity in a cross-entity join", + "type": "string" + } + }, + "required": ["type", "alias"] } - }, - "required": [ - "type", - "alias" ] } diff --git a/src/main/resources/swagger.api/schemas/entityTypeSourceJoin.json b/src/main/resources/swagger.api/schemas/entityTypeSourceJoin.json deleted file mode 100644 index 5be1475..0000000 --- a/src/main/resources/swagger.api/schemas/entityTypeSourceJoin.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "Entity Type Source Join", - "description": "Definition indicating how an entity type source can be joined", - "type": "object", - "properties": { - "type": { - "description": "Type of join", - "type": "string" - }, - "joinTo": { - "description": "Table/view to join to", - "type": "string" - }, - "condition": { - "description": "Join condition", - "type": "string" - } - }, - "required": [ - "type", - "joinTo" - ] -}