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

Regarding deprecated methods with Apps , GHAppInstallationToken.getRepositories() returns null #1178

Closed
yeikel opened this issue Jun 9, 2021 · 4 comments

Comments

@yeikel
Copy link
Contributor

yeikel commented Jun 9, 2021

I am following this documentation : https://github-api.kohsuke.org/githubappjwtauth.html

Which helped me to create the following snippet :

		GitHub gitHubApp = new GitHubBuilder().withJwtToken(jwtToken).build();
		GHApp app = gitHubApp.getApp(); // marked as deprecated

		for (GHAppInstallation installation : app.listInstallations().toList() // marked as deprecated){

			GHAppInstallationToken token = installation.createToken().create(); // marked as deprecated

			System.out.println(token.getExpiresAt());
			System.out.println(token.getToken());
			System.out.println(token.getRepositories());

		}

As you can see, most of my code here is marked as deprecated, so my guess is that you have newer apis that I should be using.

Could you please clarify what is the right usage? I was unable to find that out from the docs or the Java docs. As mentioned, I landed on the code above after following the docs. Or are they deprecated because of the @BetaApi annotation?

As a side note token.getRepositories()) returns null even when I was able to get them using the token and the API. Not sure if it is related to my use of deprecated apis or if this is a bug

image

curl --location --request GET 'api/v3/installation/repositories' \
--header 'Authorization: Bearer token.getToken()' --> This returns the repositories as expected
@yeikel yeikel changed the title Regarding deprecated methods Regarding deprecated methods with Apps Jun 9, 2021
@yeikel yeikel changed the title Regarding deprecated methods with Apps Regarding deprecated methods with Apps , GHAppInstallationToken.getRepositories() returns null Jun 9, 2021
@bitwiseman
Copy link
Member

We use deprecated to also indicate preview APIs.

@gsmet
Copy link
Contributor

gsmet commented Jun 9, 2021

That's something I wanted to discuss for 2. I think it's an anti-pattern and we should avoid this. You end up either with a ton of warnings or you suppress deprecation warnings. And if you do the latter, that means you will miss real deprecations.

@bitwiseman
Copy link
Member

bitwiseman commented Jun 9, 2021

@gsmet
Agreed. I hate the current design.

I'd like to have a way to clearly communicate to consumers of the library that these methods/classes are not covered by semver and may change at any time. On the other had, despite things being "preview" GitHub rarely makes breaking changes in them. I definitely feel we're inconveniencing/confusing a lot of users for a minimal/edge case.

See #1003 and #1017 and #1179.

We don't have to wait for v2 for either of these. For #1003, we just nuke the @Deprecated annotations on @BetaApi methods and classes. For #1017 and #1179, for v1 we can log warnings and for v2 we'll actually fail if a preview is used when it hasn't been enabled. By enabling the preview, consumers accept that they are using methods that may change.

@bitwiseman
Copy link
Member

@yeikel

As a side note token.getRepositories()) returns null even when I was able to get them using the token and the API. Not sure if it is related to my use of deprecated apis or if this is a bug

That would be a separate bug. Please file it separately.

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

No branches or pull requests

3 participants