hub4j / github-api

Java API for GitHub
https://github-api.kohsuke.org/
MIT License
1.14k stars 728 forks source link

Improve EnumTest to enforce `UNKNOWN` value for all API enums #1891

Open bitwiseman opened 3 months ago

bitwiseman commented 3 months ago

1885 showed that we haven't been checking the count of all enum values. At the same time I noticed that we do not have UNKNOWN values for all API enum.

Adding new values is not considered a breaking change by GitHub. This has caused hub4j/github-api calls to start failing unexpectedly in the the past - the new value is not recognized and we throw an exception during deserialization. No good.

We need to add UNKNOWN to all enum types that are returned from GitHub and enforce it. The test will include an exclude list to allow enum types only used during sending but not retrieving data.