github-api does in not correctly distinguish between user and organisation ownership
owners are always returned as GHUsers instead of GHOrganizations or GHUsers. Many github api calls return users and organisations alike and the distinction is made based on the type field. Making GHPerson reflect that:
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME,
include=JsonTypeInfo.As.PROPERTY,
property="type")
@JsonSubTypes({
@JsonSubTypes.Type(value=GHUser.class, name="User"),
@JsonSubTypes.Type(value=GHOrganization.class, name="Organization"),
})
public abstract class GHPerson {
will break a lot of owner related githup-api calls
Thanks for the Jackson mapping fragment.
I'm afraid at this point this is unfixable as it breaks too many existing method signatures.
Could at least the "type" attribute be exposed in the API so it can be handled by the api-user? Also the site_admin property would be valuable (all-in-all all properties exposed would make sense to have on the object-model).
@davidkarlsen PR's are welcome. Adding more information is not an API breaking-change.
This is also a big problem when using different authentication methods (app authentication with a JWT token vs app installation authentication). All the methods are available within the same class and sometimes you just get "bad credentials" response.