Bugzilla – Attachment 131374 Details for
Bug 30194
Update required JSON::Validator version
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30194: Adapt V1.pm to the latest JSON::Validator
Bug-30194-Adapt-V1pm-to-the-latest-JSONValidator.patch (text/plain), 3.60 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-03-04 12:18:54 UTC
(
hide
)
Description:
Bug 30194: Adapt V1.pm to the latest JSON::Validator
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-03-04 12:18:54 UTC
Size:
3.60 KB
patch
obsolete
>From 9ebc1db5b21ac697bc65c06298a27b6948cba378 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 25 Feb 2022 12:57:49 -0300 >Subject: [PATCH] Bug 30194: Adapt V1.pm to the latest JSON::Validator > >This patch acknowledges a refactoring that took place within >JSON::Validator, the OpenAPIv2 schema validator and the >Mojolicious::Plugin::OpenAPI plugin. > >To test: >0. Edit /etc/apt/sources.list.d/koha.list > - Duplicate the only present line, replacing 'dev' for 'exp' > Run: > $ apt update ; apt dist-upgrade >1. Apply this patch >2. Restart all: > $ restart_all ; tail -f /var/log/koha/kohadev/*.log >=> FAIL: It fails >3. Grab a bundled version of the API spec from a working Koha >4. (temporarily) tweak V1.pm to point to this file (swagger.json) >5. Repeat 2 >=> SUCCESS: Koha works with latests Mojolicious and JSON::Validator > >Work is being done on bug 30193 to come up with a reorganized spec that >conforms better to the standard and thus doesn't require step 4. >--- > Koha/REST/V1.pm | 22 ++++------------------ > 1 file changed, 4 insertions(+), 18 deletions(-) > >diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm >index 1c22a769d7..2dd9d3aaa0 100644 >--- a/Koha/REST/V1.pm >+++ b/Koha/REST/V1.pm >@@ -22,7 +22,7 @@ use Mojo::Base 'Mojolicious'; > use C4::Context; > use Koha::Logger; > >-use JSON::Validator::OpenAPI::Mojolicious; >+use JSON::Validator::Schema; > use Try::Tiny qw( catch try ); > > =head1 NAME >@@ -68,7 +68,7 @@ sub startup { > $self->secrets([$secret_passphrase]); > } > >- my $validator = JSON::Validator::OpenAPI::Mojolicious->new; >+ my $validator = JSON::Validator::Schema->new( $self->home->rel_file("api/v1/swagger/swagger.yaml") ); > > push @{$self->routes->namespaces}, 'Koha::Plugin'; > >@@ -76,12 +76,7 @@ sub startup { > my $spec; > my $swagger_schema = $self->home->rel_file("api/swagger-v2-schema.json"); > try { >- $spec = $validator->bundle( >- { >- replace => 1, >- schema => $self->home->rel_file("api/v1/swagger/swagger.yaml") >- } >- ); >+ my $spec = $validator->bundle->data; > > $self->plugin( > 'Koha::REST::Plugin::PluginRoutes' => { >@@ -95,10 +90,6 @@ sub startup { > spec => $spec, > route => $self->routes->under('/api/v1')->to('Auth#under'), > schema => ( $swagger_schema ) ? $swagger_schema : undef, >- allow_invalid_ref => >- 1, # required by our spec because $ref directly under >- # Paths-, Parameters-, Definitions- & Info-object >- # is not allowed by the OpenAPI specification. > } > ); > } >@@ -111,10 +102,9 @@ sub startup { > $logger->error("Warning: Could not load REST API spec bundle: " . $_); > > try { >- $validator->load_and_validate_schema( >+ $validator->schema( > $self->home->rel_file("api/v1/swagger/swagger.yaml"), > { >- allow_invalid_ref => 1, > schema => ( $swagger_schema ) ? $swagger_schema : undef, > } > ); >@@ -131,10 +121,6 @@ sub startup { > OpenAPI => { > spec => $spec, > route => $self->routes->under('/api/v1')->to('Auth#under'), >- allow_invalid_ref => >- 1, # required by our spec because $ref directly under >- # Paths-, Parameters-, Definitions- & Info-object >- # is not allowed by the OpenAPI specification. > } > ); > } >-- >2.35.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30194
:
131374
|
131486
|
131487
|
131488
|
131497
|
131498
|
131499
|
131500
|
131501
|
131502
|
131547
|
131548
|
131549
|
131550
|
131551
|
131552
|
132069
|
132070
|
132071
|
132072
|
132073
|
132097
|
132098
|
132099
|
132100
|
132102
|
132112
|
132116
|
132118
|
132119
|
132120
|
132121
|
132122
|
132123
|
132124
|
132125
|
132126
|
132151
|
132152
|
132252
|
132253
|
132254
|
132334
|
132335
|
132336
|
132337
|
132338
|
132339
|
132340
|
132442
|
132449