github-api icon indicating copy to clipboard operation
github-api copied to clipboard

github-api does in not correctly distinguish between user and organisation ownership

Open msperisen opened this issue 11 years ago • 4 comments

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

msperisen avatar Sep 05 '14 14:09 msperisen

Thanks for the Jackson mapping fragment.

I'm afraid at this point this is unfixable as it breaks too many existing method signatures.

kohsuke avatar Feb 15 '15 15:02 kohsuke

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 avatar Jul 30 '19 18:07 davidkarlsen

@davidkarlsen PR's are welcome. Adding more information is not an API breaking-change.

bitwiseman avatar Sep 11 '19 00:09 bitwiseman

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.

Haarolean avatar May 05 '23 13:05 Haarolean