Skip to content
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

Set policy tags to empty instead of null #545

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -60,10 +60,11 @@ com.google.api.services.bigquery.model.TableFieldSchema.PolicyTags toPb() {

static PolicyTags fromPb(
com.google.api.services.bigquery.model.TableFieldSchema.PolicyTags tagPb) {
// Treat a PolicyTag message without a Names subfield as invalid.
Builder builder = newBuilder();
// Treat a PolicyTag message without a Names subfield as empty.
if (tagPb.getNames() != null) {
return newBuilder().setNames(tagPb.getNames()).build();
builder = builder.setNames(tagPb.getNames());
}
return null;
return builder.build();
}
}
Expand Up @@ -51,7 +51,7 @@ public void testBuilder() {
public void testWithoutNames() {
com.google.api.services.bigquery.model.TableFieldSchema.PolicyTags PARTIALTAG =
new com.google.api.services.bigquery.model.TableFieldSchema.PolicyTags();
assertNull(PolicyTags.fromPb(PARTIALTAG));
assertNull(PolicyTags.fromPb(PARTIALTAG).getNames());
}

@Test
Expand Down