Skip to content

Implement BetaApi annotation for hub4j sdk - #1002

Merged
bitwiseman merged 1 commit into
hub4j:masterfrom
marcoferrer:add-sdk-beta-annotation
Dec 17, 2020
Merged

bitwiseman merged 1 commit into
hub4j:masterfrom
marcoferrer:add-sdk-beta-annotation

Conversation

@marcoferrer

@marcoferrer marcoferrer commented Dec 16, 2020 •

Copy link
Copy Markdown
Contributor

Description

This PR introduces a @BetaApi annotation to help differentiate Github @Preview APIs from hub4j beta APIs. The reasoning behind this change is based on the findings outlined in #1001. With these changes, the preview media type is now a hard requirement. Architecture tests have been added to ensure beta APIs are annotated as deprecated and that usages of preview do not allow empty arrays.

Before submitting a PR:

We love getting PRs, but we hate asking people for the same basic changes every time.

  • Push your changes to a branch other than master. Create your PR from that branch.
  • Add JavaDocs and other comments
  • Write tests that run and pass in CI. See CONTRIBUTING.md for details on how to capture snapshot data.
  • Run mvn clean compile locally. This may reformat your code, commit those changes.
  • Run mvn -D enable-ci clean install site locally. If this command doesn't succeed, your change will not pass CI.

When creating a PR:

  • Fill in the "Description" above.
  • Enable "Allow edits from maintainers".

@marcoferrer marcoferrer changed the title Implement beta api annotation to project Implement BetaApi annotation for hub4j sdk Dec 16, 2020
* @return true if the push to this branch is restricted via branch protection.
*/
@Preview
@Preview(Previews.LUKE_CAGE)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was a miss from the preview PR caught by the new arch tests

}

@Preview
@Preview(SQUIRREL_GIRL)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was a miss from the preview PR caught by the new arch tests

*/
@Deprecated
@Preview
public List<GHAsset> assets() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was unable to find anything in the Github API documentation that confirms this is a preview API.
https://developer.github.com/v3/repos/releases/#list-release-assets

.withImportOption(new ImportOption.DoNotIncludeJars())
.importPackages("org.kohsuke.github");

private static final DescribedPredicate<JavaAnnotation<?>> previewAnnotationWithNoMediaType = new DescribedPredicate<JavaAnnotation<?>>(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This predicate ensures that no usages of the preview annotation will accept an empty array for the value param.

*/
@Preview
@Deprecated
@CheckForNull

@marcoferrer marcoferrer Dec 16, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This method was not labeled properly. The field itself is not part of a preview API. It is only optionally present depending on the source of the data. We've already indicated the potential lack of presence with the @CheckForNull annotation.

@bitwiseman bitwiseman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great.

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.

2 participants