Skip to content

Commit

Permalink
add default patcher for registry schema importers
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Oct 25, 2023
1 parent f27a6aa commit 1576fee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as util from 'util';
import { isSuccess, Result } from '@cdklabs/tskb';
import * as _glob from 'glob';
import { Loader, LoadResult, LoadSourceOptions } from './loader';
import { patchCloudFormationRegistry } from '../patches';
import { JsonLensPatcher } from '../patching';
import { ProblemReport, ReportAudience } from '../report';
import { CloudFormationRegistryResource } from '../types';
Expand All @@ -23,7 +24,7 @@ export function loadCloudFormationRegistryDirectory(
'CloudFormationRegistryResource.schema.json',
{
mustValidate: options.validate,
patcher: options.patcher,
patcher: options.patcher ?? patchCloudFormationRegistry,
errorRootDirectory: baseDir,
},
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assertSuccess } from '@cdklabs/tskb';
import { Loader, LoadResult, LoadSourceOptions } from './loader';
// import { patchSamTemplateSpec } from '../../../aws-service-spec/build/patches/sam-patches';
import { normalizeJsonSchema } from '../patches';
import { JsonLensPatcher } from '../patching';
import { SamTemplateSchema } from '../types';

Expand All @@ -17,7 +17,7 @@ export async function loadSamSchema(
): Promise<LoadResult<SamTemplateSchema>> {
const loader = await Loader.fromSchemaFile<SamTemplateSchema>('SamTemplateSchema.schema.json', {
mustValidate: options.validate,
patcher: options.patcher,
patcher: options.patcher ?? normalizeJsonSchema,
});

const result = await loader.loadFile(filePath);
Expand Down

0 comments on commit 1576fee

Please sign in to comment.