diff --git a/.changeset/gentle-bobcats-laugh.md b/.changeset/gentle-bobcats-laugh.md new file mode 100644 index 000000000..948d1463b --- /dev/null +++ b/.changeset/gentle-bobcats-laugh.md @@ -0,0 +1,6 @@ +--- +'@flatfile/plugin-convert-json-schema': minor +'@flatfile/plugin-convert-openapi-schema': minor +--- + +This release provides better support for the JSON schema array field type by mapping it to a Flatfile string-list. diff --git a/package-lock.json b/package-lock.json index e71cbc887..b2bec777a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -247,7 +247,7 @@ }, "extract/html-table": { "name": "@flatfile/plugin-extract-html-table", - "version": "1.2.0", + "version": "1.2.1", "license": "ISC", "dependencies": { "@flatfile/util-extractor": "^2.2.1", @@ -262,7 +262,7 @@ }, "extract/markdown": { "name": "@flatfile/plugin-extract-markdown", - "version": "0.2.0", + "version": "0.2.1", "license": "ISC", "dependencies": { "@flatfile/util-extractor": "^2.2.1" @@ -17306,7 +17306,7 @@ }, "plugins/json-extractor": { "name": "@flatfile/plugin-json-extractor", - "version": "0.9.0", + "version": "0.9.1", "license": "ISC", "dependencies": { "@flatfile/util-extractor": "^2.2.1" @@ -17621,7 +17621,7 @@ }, "plugins/xml-extractor": { "name": "@flatfile/plugin-xml-extractor", - "version": "0.8.0", + "version": "0.8.1", "license": "ISC", "dependencies": { "@flatfile/util-extractor": "^2.2.1", diff --git a/plugins/json-schema/src/setup.factory.spec.ts b/plugins/json-schema/src/setup.factory.spec.ts index 80421bc5f..b5e86588e 100644 --- a/plugins/json-schema/src/setup.factory.spec.ts +++ b/plugins/json-schema/src/setup.factory.spec.ts @@ -63,11 +63,10 @@ describe('generateSetup()', () => { type: 'number', }, { - config: { options: [] }, - description: 'An enum of Selected Values', + description: 'A column for string arrays!', key: 'arrayColumn', label: 'arrayColumn', - type: 'enum', + type: 'string-list', }, { description: 'A column for unique numbers!', diff --git a/plugins/json-schema/src/setup.factory.ts b/plugins/json-schema/src/setup.factory.ts index 2a045f934..b98a2356b 100644 --- a/plugins/json-schema/src/setup.factory.ts +++ b/plugins/json-schema/src/setup.factory.ts @@ -140,22 +140,11 @@ export async function getPropertyType( boolean: { key: parentKey, type: 'boolean' }, array: { key: parentKey, - type: 'enum', - description: 'An enum of Selected Values', - config: property.enum - ? { - options: property.enum.map((value: any) => ({ - value, - label: String(value), - })), - } - : { - options: [], - }, + type: 'string-list', }, enum: { key: parentKey, - type: 'enum', + type: 'enum-list', config: property?.enum ? { options: property.enum.map((value: any) => ({ @@ -169,6 +158,8 @@ export async function getPropertyType( }, } + if (!fieldTypes[property.type]) return [] + const fieldConfig: Flatfile.Property = { label: parentKey, ...(property?.description && { description: property.description }), @@ -176,7 +167,7 @@ export async function getPropertyType( ...fieldTypes[property.type], } - return fieldTypes[fieldConfig.type] ? [fieldConfig] : [] + return [fieldConfig] } export async function resolveReference( diff --git a/plugins/openapi-schema/src/setup.factory.ts b/plugins/openapi-schema/src/setup.factory.ts index 4e8bd1a3a..81eaee2e7 100644 --- a/plugins/openapi-schema/src/setup.factory.ts +++ b/plugins/openapi-schema/src/setup.factory.ts @@ -192,18 +192,8 @@ export async function getPropertyType( boolean: { key: parentKey, type: 'boolean' }, array: { key: parentKey, - type: 'enum', - description: 'An enum of Selected Values', - config: property.enum - ? { - options: property.enum.map((value: any) => ({ - value, - label: String(value), - })), - } - : { - options: [], - }, + type: 'string-list', + description: 'A column for string arrays!', }, enum: { key: parentKey, diff --git a/plugins/yaml-schema/src/setup.factory.spec.ts b/plugins/yaml-schema/src/setup.factory.spec.ts index f0d836962..4512487d3 100644 --- a/plugins/yaml-schema/src/setup.factory.spec.ts +++ b/plugins/yaml-schema/src/setup.factory.spec.ts @@ -31,10 +31,9 @@ describe('configureSpaceWithYamlSchema() e2e', () => { }, { label: 'arrayColumn', - description: 'An enum of Selected Values', + description: 'A column for string arrays!', key: 'arrayColumn', - type: 'enum', - config: { options: [] }, + type: 'string-list', }, { label: 'objectColumn_nestedUniqueNumberColumn',