-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: model primaryIdentifier in database (#617)
Adds the `primaryIdentifier` property from the resource spec to the database. I can see the ensuing result in `db.json` after building. It is typed as `string[]` because there are roughly 140 resources with > 1 `primaryIdentifiers`. There are also 7 resources with no `primaryIdentifiers`. --------- Signed-off-by: github-actions <github-actions@github.com> Co-authored-by: github-actions <github-actions@github.com>
- Loading branch information
Showing
6 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/@aws-cdk/service-spec-importers/test/cloudformation-registry.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { emptyDatabase } from '@aws-cdk/service-spec-types'; | ||
import { importCloudFormationRegistryResource } from '../src/import-cloudformation-registry'; | ||
import { ProblemReport } from '../src/report'; | ||
|
||
let db: ReturnType<typeof emptyDatabase>; | ||
let report: ProblemReport; | ||
beforeEach(() => { | ||
db = emptyDatabase(); | ||
report = new ProblemReport(); | ||
}); | ||
|
||
test('include primaryIdentifier in database', () => { | ||
importCloudFormationRegistryResource({ | ||
db, | ||
report, | ||
resource: { | ||
typeName: 'AWS::Some::Type', | ||
description: 'resource with PrimaryIdentifier', | ||
properties: { | ||
id: { | ||
type: 'string', | ||
}, | ||
secondId: { | ||
type: 'string', | ||
}, | ||
notId: { | ||
type: 'string', | ||
}, | ||
}, | ||
primaryIdentifier: ['/properties/id', '/properties/secondId'], | ||
}, | ||
}); | ||
|
||
// eslint-disable-next-line prettier/prettier | ||
const primaryIdentifier = db.lookup('resource', 'cloudFormationType', 'equals', 'AWS::Some::Type')[0]?.primaryIdentifier; | ||
expect(primaryIdentifier).toEqual(['id', 'secondId']); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters