EMS.ResourceTypes.ResourceVersionAttribute

From RAD Studio API Documentation
Jump to: navigation, search

EMS.ResourceTypes.TResourceCustomAttributeSystem.TCustomAttributeSystem.TObjectResourceVersionAttribute

Delphi

ResourceVersionAttribute = class(TResourceCustomAttribute)

C++

class PASCALIMPLEMENTATION ResourceVersionAttribute : public TResourceCustomAttribute

Properties

Type Visibility Source Unit Parent
class public
EMS.ResourceTypes.pas
EMS.ResourceTypes.hpp
EMS.ResourceTypes EMS.ResourceTypes

Description

Attribute to specify the API version of an EMS resource class.

Allows exporting multiple versions of the same API function. Additionally, it will enable you to invoke the REST API of the most recent version or a specific one.

The version value format is not predefined. The recommended format is "major.minor", e.g., "2.5".
The version status defines the resource base URL, extra response headers, and information in the Swagger API documentation.

Example:

  [ResourceVersion('v1', TEMSVersionStatus.Deprecated)]
  [ResourceName('myapi')]
  TMyapiResource1 = class(TDataModule)
    .....
  end;

  [ResourceVersion('v2', TEMSVersionStatus.Default)]
  [ResourceName('myapi')]
  TMyapiResource2 = class(TDataModule)
    .....
  end;

This leads to endpoint registrations, as such:

v1/myapi/...
v2/myapi/...
myapi/...

See Also