diff --git a/packages/@aws-cdk/aws-apigateway/lib/util.ts b/packages/@aws-cdk/aws-apigateway/lib/util.ts index 550250edcd432..a97f89882fe04 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/util.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/util.ts @@ -101,7 +101,6 @@ export class JsonSchemaMapper { private static readonly SchemaPropsWithPrefix: { [key: string]: string } = { schema: '$schema', ref: '$ref', - id: '$id', }; // The value indicates whether direct children should be key-mapped. private static readonly SchemaPropsWithUserDefinedChildren: { [key: string]: boolean } = { diff --git a/packages/@aws-cdk/aws-apigateway/test/util.test.ts b/packages/@aws-cdk/aws-apigateway/test/util.test.ts index 30861de05dad1..79ea5c60e9682 100644 --- a/packages/@aws-cdk/aws-apigateway/test/util.test.ts +++ b/packages/@aws-cdk/aws-apigateway/test/util.test.ts @@ -1,4 +1,4 @@ -import { JsonSchema, JsonSchemaType } from '../lib'; +import { JsonSchema, JsonSchemaType, JsonSchemaVersion } from '../lib'; import { JsonSchemaMapper, parseAwsApiCall, parseMethodOptionsPath } from '../lib/util'; describe('util', () => { @@ -136,5 +136,18 @@ describe('util', () => { default: 'blue', }); }); + + test('"id" maps to "id" when using DRAFT-04', () => { + const schema: JsonSchema = { + schema: JsonSchemaVersion.DRAFT4, + id: 'http://json-schema.org/draft-04/schema#', + }; + + const actual = JsonSchemaMapper.toCfnJsonSchema(schema); + expect(actual).toEqual({ + $schema: 'http://json-schema.org/draft-04/schema#', + id: 'http://json-schema.org/draft-04/schema#', + }); + }); }); });