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

Add polymorphic deserialization for event account. #1522

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bloslo
Copy link
Contributor

@bloslo bloslo commented Sep 18, 2022

Description

Add polymorphic deserialization for the GHAppInstallation account field.
Fixes #1497

Before submitting a PR:

  • Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, CONTRIBUTING.md for details.
  • Add JavaDocs and other comments as appropriate. Consider including links in comments to relevant documentation on https://docs.github.com/en/rest .
  • Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See CONTRIBUTING.md for details.
  • Run mvn -D enable-ci clean install site locally. If this command doesn't succeed, your change will not pass CI.
  • Push your changes to a branch other than main. You will create your PR from that branch.

When creating a PR:

  • Fill in the "Description" above with clear summary of the changes. This includes:
    • If this PR fixes one or more issues, include "Fixes #" lines for each issue.
    • Provide links to relevant documentation on https://docs.github.com/en/rest where possible.
  • All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
  • Enable "Allow edits from maintainers".

@codecov
Copy link

codecov bot commented Sep 18, 2022

Codecov Report

Patch and project coverage have no change.

Comparison is base (5380f59) 79.89% compared to head (1581500) 79.89%.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1522   +/-   ##
=========================================
  Coverage     79.89%   79.89%           
  Complexity     2197     2197           
=========================================
  Files           209      209           
  Lines          6670     6670           
  Branches        364      364           
=========================================
  Hits           5329     5329           
  Misses         1127     1127           
  Partials        214      214           
Impacted Files Coverage Δ
...ain/java/org/kohsuke/github/GHAppInstallation.java 92.10% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bloslo
Copy link
Contributor Author

bloslo commented Sep 30, 2022

@bitwiseman Can you review my changes? I know checks are breaking, but this is because I change a method signature. I don't see how this can be avoided.

P.S. I used the StackOverflow link you referenced in the issue as a source to implement the changes.

@bitwiseman
Copy link
Member

@bloslo
To address API breaks, you'll need to use WithBridgeMethods annotations. They preserve binary compatibility while letting you update the source API. Usage is described in the source file and there are plenty of examples in this project.

Copy link
Member

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

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

Changes look good, nicely done!

Add bridge methods to fix API breaks. The bridge will need to be a custom conversion method. And you'll need to add a test that makes sure the scenario where someone calls the old GHUser method when the instance is now aGHOrganization still works the same as before. You don't have to improve the behavior, just make sure it isn't any more broken.

@Haarolean
Copy link
Contributor

@bitwiseman is there a chance to get this merged in?

@bitwiseman
Copy link
Member

@Haarolean
See my previous comment. There are API breaking changes that need to be addressed (using bridge methods) before this can be merged.

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.

GHUser even when event comes from Organization type
3 participants