Versioning for custom resources

Created on 31 July 2013, almost 12 years ago
Updated 10 May 2024, 12 months ago

services.versions.api.php claims that you can add versioning by creating update functions in the following format: _{RESOURCE_NAME}_resource_{METHOD_NAME}_update_{MAJOR_VERSION}_{MINOR_VERSION}

Perhaps I'm missing something, but this seems to only work for core resources, as those are the only ones loaded by services_get_updates() ...

function services_get_updates() {
  $updates = &drupal_static(__FUNCTION__, array());
  if (!isset($updates) || empty($updates)) {
    $updates = array();
    module_load_include('resource_build.inc', 'services');
    // Load the resources for services.
    _services_core_resources();
    ...
function _services_core_resources() {
  module_load_include('inc', 'services', 'resources/comment_resource');
  module_load_include('inc', 'services', 'resources/file_resource');
  module_load_include('inc', 'services', 'resources/node_resource');
  module_load_include('inc', 'services', 'resources/system_resource');
  module_load_include('inc', 'services', 'resources/taxonomy_resource');
  module_load_include('inc', 'services', 'resources/user_resource');

  $resources = array(
    '#api_version' => 3002,
  );  

  $resources += _comment_resource_definition();
  $resources += _file_resource_definition();
  $resources += _node_resource_definition();
  $resources += _system_resource_definition();
  $resources += _taxonomy_resource_definition();
  $resources += _user_resource_definition();

  return $resources;
}
💬 Support request
Status

Closed: cannot reproduce

Version

3.5

Component

Documentation

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024