Skip to content

Conversation

@dpilch
Copy link
Contributor

@dpilch dpilch commented Aug 2, 2024

Description of changes

Add overrideIndex name to @belongsTo to change the name of the GSI that is automatically created with references.

CDK / CloudFormation Parameters Changed

See above.

Issue #, if available

N/A

Description of how you validated changes

  • Unit testing
  • E2E testing

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dpilch dpilch force-pushed the configure-index-name branch from 091def5 to 7c8da3d Compare August 2, 2024 19:42
@dpilch dpilch marked this pull request as ready for review August 6, 2024 16:45
@dpilch dpilch requested a review from a team as a code owner August 6, 2024 16:45
import { Directive } from './directive';

const name = 'belongsTo';
// TODO: review overrideIndexName before merging to main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is override prefix necessary here? Can we just keep it indexName and if specified it means an override, otherwise use default?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will discuss further in API naming review, but I wouldn't favor overloading the indexName directive with different behavior like that.

@dpilch dpilch enabled auto-merge (squash) August 8, 2024 19:35
Comment on lines +77 to +80
const overrideIndexName = getOverrideIndexName(config);
if (overrideIndexName) {
config.indexName = overrideIndexName;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Super nitpicky here & below: why separate this assignment from the config.indexName assignment 2 lines above, as opposed to a single block to handle the default & override cases?
  2. Can you confirm that even though we're processing the GSI name in hasOne and hasMany transformers, it's actually created on the related belongsTo table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { Directive } from './directive';

const name = 'belongsTo';
// TODO: review overrideIndexName before merging to main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will discuss further in API naming review, but I wouldn't favor overloading the indexName directive with different behavior like that.

Copy link
Member

@palpatim palpatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending addressing nitpicky comments in a future PR

@dpilch dpilch merged commit c4e59d3 into feature/gen2-migration Aug 8, 2024
@dpilch dpilch deleted the configure-index-name branch August 8, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants