@@ -, +, @@ --- Koha/Item.pm | 17 +++++++++++++++++ api/v1/swagger/definitions/item.yaml | 5 +++++ 2 files changed, 22 insertions(+) --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -1297,6 +1297,23 @@ sub public_read_list { ]; } +=head3 to_api + +Overloaded to_api method to ensure item-level itypes is adhered to. + +=cut + +sub to_api { + my ($self, $params) = @_; + + my $response = $self->SUPER::to_api($params); + my $overrides = {}; + + $overrides->{effective_item_type_id} = $self->effective_itemtype; + + return { %$response, %$overrides }; +} + =head3 to_api_mapping This method returns the mapping for representing a Koha::Item object --- a/api/v1/swagger/definitions/item.yaml +++ a/api/v1/swagger/definitions/item.yaml @@ -183,6 +183,11 @@ properties: - string - "null" description: Itemtype defining the type for this item + effective_item_type_id: + type: + - string + - "null" + description: Effective itemtype defining the type for this item_id extended_subfields: type: - string --