From 2742ded0bdb7fad3f576b29545c4c4b034062531 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 7 Dec 2023 13:03:12 +0000 Subject: [PATCH] Bug 35197: Field name consistency This patch adds a to_api_mapping and updates the yaml definitions to be ensure we are consistent with modern best practice for our api field names. Signed-off-by: Martin Renvoize --- Koha/AdditionalField.pm | 17 +++++++++++++++++ .../swagger/definitions/additional_field.yaml | 18 +++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Koha/AdditionalField.pm b/Koha/AdditionalField.pm index 77a43724cce..19f93c7cd93 100644 --- a/Koha/AdditionalField.pm +++ b/Koha/AdditionalField.pm @@ -42,6 +42,23 @@ sub effective_authorised_value_category { return $category; } +=head3 to_api_mapping + +This method returns the mapping for representing an AdditionalField object +on the API. + +=cut + +sub to_api_mapping { + return { + id => 'additional_field_id', + tablename => 'table_name', + authorised_value_category => 'authorised_value_category_name', + marcfield => 'marc_field', + marcfield_mode => 'marc_field_mode' + }; +} + sub _type { 'AdditionalField' } =head1 AUTHOR diff --git a/api/v1/swagger/definitions/additional_field.yaml b/api/v1/swagger/definitions/additional_field.yaml index 5fa3a3e6995..35d5097c455 100644 --- a/api/v1/swagger/definitions/additional_field.yaml +++ b/api/v1/swagger/definitions/additional_field.yaml @@ -1,26 +1,26 @@ --- type: object properties: - id: + additional_field_id: type: integer description: internally assigned additional field identifier readOnly: true - tablename: + table_name: description: name of the table this additional field corresponds to type: string name: description: name of the additional field type: string - authorised_value_category: + authorised_value_category_name: description: authorised value category of the additional field type: - string - "null" - marcfield: - description: marcfield of the additional field + marc_field: + description: marc field of the additional field type: string - marcfield_mode: - description: marcfield mode of the additional field + marc_field_mode: + description: marc field mode of the additional field type: string enum: - get @@ -31,5 +31,5 @@ properties: additionalProperties: false required: - - id - - tablename \ No newline at end of file + - additional_field_id + - table_name -- 2.45.2