From fd2c72fd886ecaaf0f6588a328ff8a268a54fb55 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Wed, 24 May 2023 13:31:00 -0700 Subject: [PATCH] fix(types): fix broken appium config schema types, temporarily This appears to be a bug in `json-schema-to-typescript`, where the `ipv6` type converts to `{[key: string]: unknown}` instead of `string`. For now, we need to drop all formatting requirements from the `address` prop until this is fixed. This did not break CI because the `build` script of `@appium/types` was run either _after_ building the rest of the project, or not at all, and the resulting change to `appium-config.ts` was not committed. --- packages/appium/test/fixtures/flattened-schema.js | 8 -------- packages/schema/lib/appium-config-schema.js | 7 ++----- packages/schema/lib/appium-config.schema.json | 10 +--------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/packages/appium/test/fixtures/flattened-schema.js b/packages/appium/test/fixtures/flattened-schema.js index a4111cb89..61d1412f9 100644 --- a/packages/appium/test/fixtures/flattened-schema.js +++ b/packages/appium/test/fixtures/flattened-schema.js @@ -11,14 +11,6 @@ export default [ ref: 'appium.json#/properties/server/properties/address', }, schema: { - anyOf: [ - { - format: 'hostname' - }, - { - format: 'ipv6' - } - ], appiumCliAliases: ['a'], default: '0.0.0.0', description: 'IPv4/IPv6 address or a hostname to listen on', diff --git a/packages/schema/lib/appium-config-schema.js b/packages/schema/lib/appium-config-schema.js index 1d2acfb80..92eee031a 100644 --- a/packages/schema/lib/appium-config-schema.js +++ b/packages/schema/lib/appium-config-schema.js @@ -24,12 +24,9 @@ export const AppiumConfigJsonSchema = /** @type {const} */ ({ appiumCliAliases: ['a'], default: '0.0.0.0', description: 'IPv4/IPv6 address or a hostname to listen on', - anyOf: [ - { format: 'hostname' }, - { format: 'ipv6' } - ], title: 'address config', type: 'string', + // this should be anyOf [format: "hostname" or format: "ipv6"], but there seems to be a bug in json-schema-to-typescript preventing "ipv6" from converting to type "string"' }, 'allow-cors': { description: @@ -340,7 +337,7 @@ export const AppiumConfigJsonSchema = /** @type {const} */ ({ }, }, { - oneOf: [{$ref: '#/$defs/logFilterText'}, {$ref: '#/$defs/logFilterRegex'}], + anyOf: [{$ref: '#/$defs/logFilterText'}, {$ref: '#/$defs/logFilterRegex'}], }, ], }, diff --git a/packages/schema/lib/appium-config.schema.json b/packages/schema/lib/appium-config.schema.json index bebf84533..18af02666 100644 --- a/packages/schema/lib/appium-config.schema.json +++ b/packages/schema/lib/appium-config.schema.json @@ -19,14 +19,6 @@ ], "default": "0.0.0.0", "description": "IPv4/IPv6 address or a hostname to listen on", - "anyOf": [ - { - "format": "hostname" - }, - { - "format": "ipv6" - } - ], "title": "address config", "type": "string" }, @@ -345,7 +337,7 @@ } }, { - "oneOf": [ + "anyOf": [ { "$ref": "#/$defs/logFilterText" },