@@ -, +, @@ definition --- api/v1/definitions/item.json | 4 ++++ t/db_dependent/api/v1/items.t | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) --- a/api/v1/definitions/item.json +++ a/api/v1/definitions/item.json @@ -172,6 +172,10 @@ "stocknumber": { "type": ["string", "null"], "description": "inventory number" + }, + "new_status": { + "type": ["string", "null"], + "description": "'new' value, whatever free-text information." } } } --- a/t/db_dependent/api/v1/items.t +++ a/t/db_dependent/api/v1/items.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 12; +use Test::More tests => 13; use Test::Mojo; use t::lib::TestBuilder; @@ -34,6 +34,23 @@ use Koha::Items; my $builder = t::lib::TestBuilder->new(); +subtest 'Swagger item-definition and Koha::Item' => sub { + plan tests => 2; + + use_ok("Swagger2"); + my $swagger = Swagger2->new(C4::Context->config('intranetdir')."/api/v1/swagger.json")->expand; + my $api_spec = $swagger->api_spec->data; + + my $properties = $api_spec->{definitions}->{"item"}->{properties}; + my @columns = Koha::Item->new->_result->columns; + my @missing; + foreach my $column (@columns) { + push @missing, $column unless $properties->{$column}; + } + + is(join(', ' , @missing), "", "Item definition up-to-date with Koha::Item columns."); +}; + my $dbh = C4::Context->dbh; $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; --