From 595ca4a278571ffbfb7e770066ba14eaad864662 Mon Sep 17 00:00:00 2001 From: Morgan Leroi Date: Tue, 7 Feb 2023 21:35:59 +0100 Subject: [PATCH 1/5] feat(specs): add CSV source --- specs/ingestion/common/schemas/source.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/specs/ingestion/common/schemas/source.yml b/specs/ingestion/common/schemas/source.yml index 3e122bed49..1c5e8a2314 100644 --- a/specs/ingestion/common/schemas/source.yml +++ b/specs/ingestion/common/schemas/source.yml @@ -95,7 +95,7 @@ SourceSearch: SourceType: type: string - enum: ['bigcommerce', 'commercetools', 'json'] + enum: ['bigcommerce', 'commercetools', 'json', 'csv'] SourceCommercetools: type: object @@ -146,11 +146,29 @@ SourceJson: required: - url +SourceCsv: + type: object + additionalProperties: false + properties: + url: + type: string + uniqueIDColumn: + type: string + mapping: + type: object + additionalProperties: + type: string + method: + $ref: '#/MethodType' + required: + - url + SourceInput: oneOf: - $ref: '#/SourceCommercetools' - $ref: '#/SourceBigCommerce' - $ref: '#/SourceJson' + - $ref: '#/SourceCsv' SourceUpdateCommercetools: type: object From 5ed485528b8a31cf16ac6e7418f7d8264742a901 Mon Sep 17 00:00:00 2001 From: Morgan Leroi Date: Wed, 8 Feb 2023 09:01:06 +0100 Subject: [PATCH 2/5] feat(specs): add CSV source --- specs/ingestion/common/schemas/source.yml | 44 +++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/specs/ingestion/common/schemas/source.yml b/specs/ingestion/common/schemas/source.yml index 1c5e8a2314..47d24cdc84 100644 --- a/specs/ingestion/common/schemas/source.yml +++ b/specs/ingestion/common/schemas/source.yml @@ -134,7 +134,7 @@ MethodType: type: string enum: ['GET', 'POST'] -SourceJson: +SourceJSON: type: object additionalProperties: false properties: @@ -146,18 +146,26 @@ SourceJson: required: - url -SourceCsv: +MappingTypeCSV: + type: string + enum: ['string','integer','float','boolean','json'] + +SourceCSV: type: object additionalProperties: false properties: url: type: string + description: The URL of the file. uniqueIDColumn: type: string + description: The name of the column that contains the unique ID. mapping: type: object + description: > + Mapping of type for every column. For example {"myColumn": "boolean, "myOtherColumn": "json"}. additionalProperties: - type: string + $ref: '#/MappingTypeCSV' method: $ref: '#/MethodType' required: @@ -167,8 +175,8 @@ SourceInput: oneOf: - $ref: '#/SourceCommercetools' - $ref: '#/SourceBigCommerce' - - $ref: '#/SourceJson' - - $ref: '#/SourceCsv' + - $ref: '#/SourceJSON' + - $ref: '#/SourceCSV' SourceUpdateCommercetools: type: object @@ -186,13 +194,34 @@ SourceUpdateCommercetools: items: type: string -SourceUpdateJson: +SourceUpdateJSON: + type: object + additionalProperties: false + properties: + url: + type: string + description: The URL of the file. + method: + $ref: '#/MethodType' + required: + - url + +SourceUpdateCSV: type: object additionalProperties: false properties: url: type: string description: The URL of the file. + uniqueIDColumn: + type: string + description: The name of the column that contains the unique ID. + mapping: + type: object + description: > + Mapping of type for every column. For example {"myColumn": "boolean, "myOtherColumn": "json"}. + additionalProperties: + $ref: '#/MappingTypeCSV' method: $ref: '#/MethodType' required: @@ -201,4 +230,5 @@ SourceUpdateJson: SourceUpdateInput: oneOf: - $ref: '#/SourceUpdateCommercetools' - - $ref: '#/SourceUpdateJson' + - $ref: '#/SourceUpdateJSON' + - $ref: '#/SourceUpdateCSV' From 3590ff565a667d526c3a4e97588481890b2b345d Mon Sep 17 00:00:00 2001 From: Morgan Leroi Date: Wed, 8 Feb 2023 09:28:21 +0100 Subject: [PATCH 3/5] Update specs/ingestion/common/schemas/source.yml Co-authored-by: Pierre Millot --- specs/ingestion/common/schemas/source.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/ingestion/common/schemas/source.yml b/specs/ingestion/common/schemas/source.yml index 47d24cdc84..74129c0a5d 100644 --- a/specs/ingestion/common/schemas/source.yml +++ b/specs/ingestion/common/schemas/source.yml @@ -163,7 +163,7 @@ SourceCSV: mapping: type: object description: > - Mapping of type for every column. For example {"myColumn": "boolean, "myOtherColumn": "json"}. + Mapping of type for every column. For example {"myColumn": "boolean", "myOtherColumn": "json"}. additionalProperties: $ref: '#/MappingTypeCSV' method: From 3f648d4d9dde8a155b8ced4d644072e9a7346d00 Mon Sep 17 00:00:00 2001 From: Morgan Leroi Date: Wed, 8 Feb 2023 09:28:37 +0100 Subject: [PATCH 4/5] Update specs/ingestion/common/schemas/source.yml Co-authored-by: Pierre Millot --- specs/ingestion/common/schemas/source.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/ingestion/common/schemas/source.yml b/specs/ingestion/common/schemas/source.yml index 74129c0a5d..f707e193c4 100644 --- a/specs/ingestion/common/schemas/source.yml +++ b/specs/ingestion/common/schemas/source.yml @@ -159,7 +159,7 @@ SourceCSV: description: The URL of the file. uniqueIDColumn: type: string - description: The name of the column that contains the unique ID. + description: The name of the column that contains the unique ID, used as `objectID` in Algolia. mapping: type: object description: > From 9b1eb87df3218f026bb84b3f1a9f614879dd6ed6 Mon Sep 17 00:00:00 2001 From: Morgan Leroi Date: Wed, 8 Feb 2023 09:36:30 +0100 Subject: [PATCH 5/5] feat(specs): add CSV source --- specs/ingestion/common/schemas/source.yml | 36 ++--------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/specs/ingestion/common/schemas/source.yml b/specs/ingestion/common/schemas/source.yml index 47d24cdc84..63f3376a3b 100644 --- a/specs/ingestion/common/schemas/source.yml +++ b/specs/ingestion/common/schemas/source.yml @@ -194,41 +194,9 @@ SourceUpdateCommercetools: items: type: string -SourceUpdateJSON: - type: object - additionalProperties: false - properties: - url: - type: string - description: The URL of the file. - method: - $ref: '#/MethodType' - required: - - url - -SourceUpdateCSV: - type: object - additionalProperties: false - properties: - url: - type: string - description: The URL of the file. - uniqueIDColumn: - type: string - description: The name of the column that contains the unique ID. - mapping: - type: object - description: > - Mapping of type for every column. For example {"myColumn": "boolean, "myOtherColumn": "json"}. - additionalProperties: - $ref: '#/MappingTypeCSV' - method: - $ref: '#/MethodType' - required: - - url SourceUpdateInput: oneOf: - $ref: '#/SourceUpdateCommercetools' - - $ref: '#/SourceUpdateJSON' - - $ref: '#/SourceUpdateCSV' + - $ref: '#/SourceJSON' + - $ref: '#/SourceCSV'