-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent the cursor or primary key fields from being deselected #20481
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me!
// TODO(mfsiega-airbyte): we only check the top level of the cursor/primary key fields because we | ||
// don't support filtering nested fields yet. | ||
if (!selectedFieldNames.contains(config.getCursorField().get(0))) { | ||
throw new JsonValidationException("Cursor field cannot be de-selected"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to think if there could be a case where a non-cursor field shares a top-level key with a cursor field, and therefore can't be de-selected. Even if that is the case, probably better to merge this as-is for now because we're planning on adding support for nested fields relatively soon anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah as it is today we only allow selecting top-level fields (which implies all of the children) - so the only way to deselect that non-cursor-field-which-shares-a-top-level-key-with-a-cursor is to deselect the top-level field, which in turn deselects the cursor...
But indeed we should support nested fields soon, at least on the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, makes sense to me, thanks for confirming!
What
Ensure that the cursor and primary key fields can't be deselected.
We might want to allow this in some cases, but for simplicity we disallow it entirely per the PRD.
How
If but
cursor
/primary key
andselectedFields
are provided, check that the key field is included in the list of selected fields.