From 85bb1c7ef99e1702c3ea89f58279b3c21f1a28dc Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 7 Sep 2021 21:52:43 -0400 Subject: [PATCH] (perlcritic) JSON::Any -> JSON::MaybeXS --- flake.nix | 2 +- src/lib/Hydra/Controller/API.pm | 10 +++++----- src/lib/Hydra/Controller/Job.pm | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index a769cfa8..948b784d 100644 --- a/flake.nix +++ b/flake.nix @@ -461,7 +461,7 @@ IOCompress IPCRun JSON - JSONAny + JSONMaybeXS JSONXS LWP LWPProtocolHttps diff --git a/src/lib/Hydra/Controller/API.pm b/src/lib/Hydra/Controller/API.pm index ccc37298..474a0021 100644 --- a/src/lib/Hydra/Controller/API.pm +++ b/src/lib/Hydra/Controller/API.pm @@ -8,7 +8,7 @@ use Hydra::Helper::Nix; use Hydra::Helper::CatalystUtils; use Hydra::Controller::Project; use JSON; -use JSON::Any; +use JSON::MaybeXS; use DateTime; use Digest::SHA qw(sha256_hex); use Text::Diff; @@ -66,7 +66,7 @@ sub latestbuilds : Chained('api') PathPart('latestbuilds') Args(0) { push @list, buildToHash($_) foreach @latest; $c->stash->{'plain'} = { - data => scalar (JSON::Any->objToJson(\@list)) + data => scalar (encode_json(\@list)) }; $c->forward('Hydra::View::Plain'); } @@ -107,7 +107,7 @@ sub jobsets : Chained('api') PathPart('jobsets') Args(0) { push @list, jobsetToHash($_) foreach @jobsets; $c->stash->{'plain'} = { - data => scalar (JSON::Any->objToJson(\@list)) + data => scalar (encode_json(\@list)) }; $c->forward('Hydra::View::Plain'); } @@ -125,7 +125,7 @@ sub queue : Chained('api') PathPart('queue') Args(0) { push @list, buildToHash($_) foreach @builds; $c->stash->{'plain'} = { - data => scalar (JSON::Any->objToJson(\@list)) + data => scalar (encode_json(\@list)) }; $c->forward('Hydra::View::Plain'); } @@ -169,7 +169,7 @@ sub nrbuilds : Chained('api') PathPart('nrbuilds') Args(0) { @arr = reverse(@arr); $c->stash->{'plain'} = { - data => scalar (JSON::Any->objToJson(\@arr)) + data => scalar (encode_json(\@arr)) }; $c->forward('Hydra::View::Plain'); } diff --git a/src/lib/Hydra/Controller/Job.pm b/src/lib/Hydra/Controller/Job.pm index a9e65f76..25f323bf 100644 --- a/src/lib/Hydra/Controller/Job.pm +++ b/src/lib/Hydra/Controller/Job.pm @@ -6,6 +6,7 @@ use warnings; use base 'Hydra::Base::Controller::ListBuilds'; use Hydra::Helper::Nix; use Hydra::Helper::CatalystUtils; +use JSON::MaybeXS; use Net::Prometheus; sub job : Chained('/') PathPart('job') CaptureArgs(3) { @@ -50,7 +51,7 @@ sub shield :Chained('job') PathPart('shield') Args(0) { $c->response->content_type('application/json'); $c->stash->{'plain'} = { - data => scalar (JSON::Any->objToJson( + data => scalar (encode_json( { schemaVersion => 1, label => "hydra build",