diff --git a/packages/@aws-cdk/aws-service-spec/build/patches/service-patches/dms.ts b/packages/@aws-cdk/aws-service-spec/build/patches/service-patches/dms.ts index 61c0170d9..c33a0e843 100644 --- a/packages/@aws-cdk/aws-service-spec/build/patches/service-patches/dms.ts +++ b/packages/@aws-cdk/aws-service-spec/build/patches/service-patches/dms.ts @@ -1,4 +1,4 @@ -import { fp, registerServicePatches } from './core'; +import { fp, registerServicePatches, replaceResourceProperty, forResource } from './core'; import { patching, types } from '@aws-cdk/service-spec-importers'; registerServicePatches( @@ -15,4 +15,142 @@ registerServicePatches( return readOnlyProperties; }, ), + + forResource('AWS::DMS::DataProvider', (lens) => { + replaceResourceProperty( + 'Settings', + { + type: 'object', + description: 'The property identifies the exact type of settings for the data provider.', + properties: { + PostgreSqlSettings: { + description: 'PostgreSqlSettings property identifier.', + type: 'object', + properties: { + ServerName: { + type: 'string', + }, + Port: { + type: 'integer', + }, + DatabaseName: { + type: 'string', + }, + SslMode: { + type: 'object', + $ref: '#/definitions/DmsSslModeValue', + }, + CertificateArn: { + type: 'string', + }, + }, + required: ['ServerName', 'Port', 'SslMode', 'DatabaseName'], + additionalProperties: false, + }, + MySqlSettings: { + description: 'MySqlSettings property identifier.', + type: 'object', + properties: { + ServerName: { + type: 'string', + }, + Port: { + type: 'integer', + }, + SslMode: { + type: 'object', + $ref: '#/definitions/DmsSslModeValue', + }, + CertificateArn: { + type: 'string', + }, + }, + required: ['ServerName', 'Port', 'SslMode'], + additionalProperties: false, + }, + OracleSettings: { + description: 'OracleSettings property identifier.', + type: 'object', + properties: { + ServerName: { + type: 'string', + }, + Port: { + type: 'integer', + }, + DatabaseName: { + type: 'string', + }, + SslMode: { + type: 'object', + $ref: '#/definitions/DmsSslModeValue', + }, + CertificateArn: { + type: 'string', + }, + AsmServer: { + type: 'string', + }, + SecretsManagerOracleAsmSecretId: { + type: 'string', + }, + SecretsManagerOracleAsmAccessRoleArn: { + type: 'string', + }, + SecretsManagerSecurityDbEncryptionSecretId: { + type: 'string', + }, + SecretsManagerSecurityDbEncryptionAccessRoleArn: { + type: 'string', + }, + }, + required: ['ServerName', 'Port', 'SslMode', 'DatabaseName'], + additionalProperties: false, + }, + MicrosoftSqlServerSettings: { + description: 'MicrosoftSqlServerSettings property identifier.', + type: 'object', + properties: { + ServerName: { + type: 'string', + }, + Port: { + type: 'integer', + }, + DatabaseName: { + type: 'string', + }, + SslMode: { + type: 'object', + $ref: '#/definitions/DmsSslModeValue', + }, + CertificateArn: { + type: 'string', + }, + }, + required: ['ServerName', 'Port', 'SslMode', 'DatabaseName'], + additionalProperties: false, + }, + }, + anyOf: [ + { + required: ['PostgreSqlSettings'], + }, + { + required: ['MySqlSettings'], + }, + { + required: ['OracleSettings'], + }, + { + required: ['MicrosoftSqlServerSettings'], + }, + ], + additionalProperties: false, + }, + patching.Reason.other( + 'Temporary fix to fix the issue of missing the Settings property till we fix the anyOff issue', + ), + )(lens); + }), ); diff --git a/packages/@aws-cdk/service-spec-importers/src/types/registry-schema/JsonSchema.ts b/packages/@aws-cdk/service-spec-importers/src/types/registry-schema/JsonSchema.ts index c8b5f77c4..69b7995cf 100644 --- a/packages/@aws-cdk/service-spec-importers/src/types/registry-schema/JsonSchema.ts +++ b/packages/@aws-cdk/service-spec-importers/src/types/registry-schema/JsonSchema.ts @@ -26,7 +26,7 @@ export namespace jsonschema { } function isTypeDefined(x: any) { - return 'type' in x; + return 'type' in x && !('$ref' in x); } export interface Annotatable { @@ -89,7 +89,14 @@ export namespace jsonschema { * Determines whether or not the provided schema represents an `anyOf` type operator. */ export function isAnyOf(x: Schema): x is AnyOf { - return !isAnyType(x) && 'anyOf' in x; + if ('anyOf' in (x as any) && !isAnyType(x)) { + for (const elem of (x as RecordLikeObject).anyOf!) { + if (!isAnyType(elem) && (isTypeDefined(elem) || isReference(elem))) { + return true; + } + } + } + return false; } export interface OneOf extends Annotatable {