Geo Primary Verification API: Add support for composite primary keys
Problem to solve
Relating to #473033 which adds a new replicable for VirtualRegistries::Packages::Maven::Cache::Entry.
The Model record above has a composite primary key, which means it is an array instead of an integer.
In the existing API, the :id of the Maven::Cache::Entry record is represented in Base64: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/api/entities/virtual_registries/packages/maven/cache/entry.rb?ref_type=heads#L10-12
In the current implementation of the Data Management API, we've typed the id to Integer.
Proposal
This issue adds composite key support to the API by:
- changing the type and name of the
idfield:-
id=>primary_identifier -
type=> string
-
- changing the
exposelogic to:- cast the ID into string if it's of type integer;
- convert the ID into base64 if it's a composite ID (i.e.
model_class.primary_key.is_a?(Array)is true).
Intended users
Edited by 🤖 GitLab Bot 🤖