Skip to content

Commit

Permalink
remove mapping to comply with draft04
Browse files Browse the repository at this point in the history
  • Loading branch information
jihndai committed Feb 8, 2022
2 parents ccc1988 + 9aa0951 commit 47f5bb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-apigateway/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,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 } = {
Expand Down
15 changes: 14 additions & 1 deletion packages/@aws-cdk/aws-apigateway/test/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonSchema, JsonSchemaType } from '../lib';
import { JsonSchema, JsonSchemaType, JsonSchemaVersion } from '../lib';
import { JsonSchemaMapper, parseAwsApiCall, parseMethodOptionsPath } from '../lib/util';

describe('util', () => {
Expand Down Expand Up @@ -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#',
});
});
});
});

0 comments on commit 47f5bb4

Please sign in to comment.