Skip to content

add options to bucket and keys#93

Merged
certainmagic merged 3 commits intoBackblaze:masterfrom
fmbz:Backblaze/fmbz/add-options-to-bucket-and-app-keys
Oct 18, 2019
Merged

add options to bucket and keys#93
certainmagic merged 3 commits intoBackblaze:masterfrom
fmbz:Backblaze/fmbz/add-options-to-bucket-and-app-keys

Conversation

@fmbz
Copy link
Contributor

@fmbz fmbz commented Oct 16, 2019

No description provided.

@B2Json.optional
private final Long expirationTimestamp;

@B2Json.required
Copy link
Contributor

Choose a reason for hiding this comment

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

generally, we don't add required to structures that we've already shipped. i'm trying to think through why we think this is safe to do...

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with ab, better to make this optional and not have to think about whether this is safe :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was an oversight - updated

(bucketInfo == null ? 0 : bucketInfo.size()) + " infos," +
(corsRules == null ? 0 : corsRules.size()) + " corsRules," +
(lifecycleRules == null ? 0 : lifecycleRules.size()) + " lifecycleRules," +
(options == null ? 0 : options.size()) + " options," +
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering about listing the options here. Would that be reasonable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

"expirationTimestamp, " +
"options"
)
public B2ApplicationKey(String accountId,
Copy link
Contributor

Choose a reason for hiding this comment

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

Incompatible change? Does this need a major version number bump?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Contributor

Choose a reason for hiding this comment

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

the B2Json.constructor annotation can only be used once per class.

Looks like there isn't a unit test for this class. Fabian, can you please create one for it? Running that test should result in an error due to having two constructor annotations

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm fine with bumping the version. in fact, fabian & i just looked and we've bumped to v4 because of other little (breaking) changes and haven't released yet, so bumping is free. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

re: unit test malay suggested -- one particularly good test is to make a structure, toJson it, fromJson it, and verify that the original and the copy match with equals. you can also toJson again to be sure that the two json versions also match, but i'm not sure that's strictly necessary most of the time (at least not if you trust your equals method).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for suggestion - updated

"expirationTimestamp, " +
"options"
)
public B2ApplicationKey(String accountId,
Copy link
Contributor

Choose a reason for hiding this comment

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

the B2Json.constructor annotation can only be used once per class.

Looks like there isn't a unit test for this class. Fabian, can you please create one for it? Running that test should result in an error due to having two constructor annotations

"expirationTimestamp, " +
"options"
)
public B2ApplicationKey(String accountId,
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm fine with bumping the version. in fact, fabian & i just looked and we've bumped to v4 because of other little (breaking) changes and haven't released yet, so bumping is free. :)

);
}

@B2Json.constructor(params = "accountId,bucketId,bucketName,bucketType," +
Copy link
Contributor

Choose a reason for hiding this comment

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

as Malay noted above, we can only have on @B2Json.constructor annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

"expirationTimestamp, " +
"options"
)
public B2ApplicationKey(String accountId,
Copy link
Contributor

Choose a reason for hiding this comment

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

re: unit test malay suggested -- one particularly good test is to make a structure, toJson it, fromJson it, and verify that the original and the copy match with equals. you can also toJson again to be sure that the two json versions also match, but i'm not sure that's strictly necessary most of the time (at least not if you trust your equals method).

Copy link
Contributor

@certainmagic certainmagic left a comment

Choose a reason for hiding this comment

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

thanks! especially for making the changelog. :)

@certainmagic certainmagic merged commit 4accc06 into Backblaze:master Oct 18, 2019
@fmbz fmbz deleted the Backblaze/fmbz/add-options-to-bucket-and-app-keys branch October 24, 2019 04:03
nbehrens-bz added a commit that referenced this pull request May 6, 2025
…rivate

Nbehrens/merge public back to private
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.

4 participants