Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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 commons regex 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 ApproachProsCons
Java Util Package
  • More consistent use of code from this library across CPS
  • Easier to write individual unit tests for.
  • Can throw more specific error message if validation doesn't match.
  • More production code
Spring/OpenApi keyword
  • Less production code
  • Inconsistent use of one validation library across code.
  • Harder to write individual unit tests for.
Apache Commons Validator
  • Similar to Java Util Library.
  • Adding extra dependency for no further advantage.

...