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

CheckRun.fromJson fails when passed CheckRun.toJson #412

Open
jtmcdole opened this issue Dec 5, 2024 · 1 comment · May be fixed by #413
Open

CheckRun.fromJson fails when passed CheckRun.toJson #412

jtmcdole opened this issue Dec 5, 2024 · 1 comment · May be fixed by #413

Comments

@jtmcdole
Copy link

jtmcdole commented Dec 5, 2024

A newly created CheckRun with a conclusion of null (empty) will encode as "null". This fails parsing with "This level of check run conclusion is unimplemented" when passed the contents of a newly created checkrun.

class CheckRunConclusion extends EnumWithValue {
static const success = CheckRunConclusion._('success');
static const failure = CheckRunConclusion._('failure');
static const neutral = CheckRunConclusion._('neutral');
static const cancelled = CheckRunConclusion._('cancelled');
static const timedOut = CheckRunConclusion._('timed_out');
static const skipped = CheckRunConclusion._('skipped');
static const actionRequired = CheckRunConclusion._('action_required');
static const empty = CheckRunConclusion._(null);
const CheckRunConclusion._(super.value);
factory CheckRunConclusion._fromValue(String? value) {
if (value == null) {
return empty;
}
for (final level in const [
success,
failure,
neutral,
cancelled,
timedOut,
skipped,
actionRequired
]) {
if (level.value == value) {
return level;
}
}
throw Exception(
'This level of check run conclusion is unimplemented: $value.');
}
}

Copy link

github-actions bot commented Dec 5, 2024

👋 Thanks for reporting! @robrbecker will take a look.

jtmcdole added a commit to jtmcdole/github.dart that referenced this issue Dec 6, 2024
Creating a new concolusion with the GitHub API and then encoding that
CheckRun to json adds: `"conclusion":"null"` to the json string;
attempting to decode that throws an exception.

Fixes SpinlockLabs#412
@jtmcdole jtmcdole linked a pull request Dec 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant