...
- Using general the Java util regex package and libraries for String validation using plain old java code.
- Use Spring validator at service level for java API's for CPS-Core, along with javax's constraint package.
- Use open api's pattern keyword for parameters passed for the cm-handle id's as part of cm-handle registration.
- Use Apache's validation library, specifically the regex validator class as part of this library.
- Throw Data Validation Exception(BAD_REQUEST 400 Error Code) on invalid ID's.
- If same rules apply for anchor as CM-Handle ID, throw the exception when creating the anchor (Current code will have to be refactored to accomplish this, as CM-Handle is registered before Anchor is created).
- Or, CPS-Core will expose a new java interface to check if anchor name is valid when registering a CM-Handle.
Pros/Cons
Implementation | Pros | Cons |
---|---|---|
Java Util Package |
|
|
Spring/OpenApi keyword |
|
|
Apache Commons Validator |