-
Notifications
You must be signed in to change notification settings - Fork 736
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
Implement static typing for previews and clean up usage declarations #1001
Implement static typing for previews and clean up usage declarations #1001
Conversation
root.createRequest() | ||
.withPreview(BAPTISTE) | ||
.withUrlPath("/repos/" + full_name) | ||
.fetchInto(this) | ||
.wrap(root); |
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.
This was a product of the formater
public B withPreview(Previews preview) { | ||
return withPreview(preview.mediaType()); | ||
} | ||
|
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.
This overload of the withPreview
method was defined to prevent us from having to update every usage of the method after Previews
was converted to an enum. This was an attempt at minimizing noise in the PR
|
||
/** | ||
* Create repository from template repository | ||
* | ||
* @see <a href="https://developer.github.com/v3/previews/#create-and-use-repository-templates">GitHub API | ||
* Previews</a> | ||
*/ | ||
static final String BAPTISE = "application/vnd.github.baptiste-preview+json"; | ||
BAPTISTE("application/vnd.github.baptiste-preview+json"), |
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.
Typo fixed throughout the codebase
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.
Excellent.
Description
This PR introduces the following changes:
Previews
const class into an enum to prevent string constants from being used at@Preview
use sites.@Preview
to include references toPreviews
enum constants.Things to consider
Previews.ANTMAN
->Previews.ANTMAN.mediaType()
@Preview
is also being used to denote sdk specific beta APIs in some cases. I suggest, when appropriate we migrate those usages to use a new annotation as to not conflate the two 'Preview' use cases. Something along the lines of@Hub4jBetaApi
or@SdkBetaApi
. After that we should have no issue making preview media types a hard requirement.Before submitting a PR:
We love getting PRs, but we hate asking people for the same basic changes every time.
master
. Create your PR from that branch.mvn clean compile
locally. This may reformat your code, commit those changes.mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.When creating a PR: