scalecube-services
scalecube-services copied to clipboard
Support qualifier format with version
Support new qualfier format: version/namespace/action.
Version: must be in a format v{d+} character v plus 1 or more digits.
-
Old qualifier format must also work. Version for currently in use qualifiers (
/namespace/actionornamespace/action) must be0. -
Add new method to Qualifier:
int getQualifierVersion()
version/namespace/action
^^^^^^^
v1 or v22 or v356 => parse v{d+}
namespace/action or /namespace/action
<= 0
If this is old qualfier format (/namespace/action or namespace/action) then 0 must be returned.
-
Add new annotation
@Versionwith default int value set to1. Validate during scanning -- don't allow negative or zero. Annotation is optional, and must be allowed only on class level. -
@ServiceMethodconsiderations: Qualifier on service method annotation must not include version. Only current behavior is allowed -- to override namespace and action.
Example:
@Version(1)
@Service("auth")
interface AuthService {
@ServiceMethod
Response createAccessKey(Request)
}
Expected qualfier: v1/auth/createAccessKey
@Version(0)
@Service("auth")
interface AuthService {
@ServiceMethod
Response createAccessKey(Request)
}
Expected: exception saying it's not allowed to set 0 as a version. **NOTE: 0 is registered value, it's used to denote absence of @Version annotation.
@Version(1)
@Service("auth")
interface AuthService {
@ServiceMethod
Response createAccessKey(Request)
@ServiceMethod("v2/auth/create_access_key")
Response createAccessKey2(Request)
}
@Service("auth")
interface AuthService {
@ServiceMethod("v1/auth/create_access_key")
Response createAccessKey(Request)
}
Expected: exception in both examples saying it's not allowed to set versions on service method.