Skip to content

Commit

Permalink
Merge pull request #12 from americanexpress/feature/main-deepak-minor…
Browse files Browse the repository at this point in the history
…-upgrade

validation_upgrade
  • Loading branch information
deepakarora3 authored Feb 5, 2024
2 parents ead5ca5 + 9563c48 commit b295fe3
Show file tree
Hide file tree
Showing 7 changed files with 433 additions and 586 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<groupId>com.americanexpress.unify.jdocs</groupId>
<artifactId>unify-jdocs</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
<packaging>jar</packaging>

<name>unify-jdocs</name>
Expand All @@ -32,7 +32,7 @@
<!-- dependency versions -->
<slf4j-api.version>1.7.30</slf4j-api.version>
<log4j-slf4j-impl.version>2.17.1</log4j-slf4j-impl.version>
<jackson.version>2.14.1</jackson.version>
<jackson.version>2.16.1</jackson.version>
<jfiglet.version>0.0.8</jfiglet.version>
<junit-jupiter-engine.version>5.3.1</junit-jupiter-engine.version>
<mockito-core.version>2.21.0</mockito-core.version>
Expand Down
594 changes: 60 additions & 534 deletions readme.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,10 @@ public enum API {
CONTENT
}

public enum VALIDATION_TYPE {
ALL_DATA_PATHS,
ONLY_MODEL_PATHS,
ONLY_AT_READ_WRITE
}

}
35 changes: 35 additions & 0 deletions src/main/java/com/americanexpress/unify/jdocs/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,18 @@ public interface Document {
/**
* Sets the type of a document. The model object needs to be already loaded. Validation against the model will
* be carried out as per the value of the variable validateAtReadWriteOnly and an exception thrown if a violation is found
* <p>
* This method is deprecated - use the new method setType(String type, CONSTS_JDOCS.VALIDATION_TYPE validationType)
*/
@Deprecated
void setType(String type, boolean validateAtReadWriteOnly);

/**
* Sets the type of a document. The model object needs to be already loaded. Validation against the model will
* be carried out as per the value of the variable validationType and an exception thrown if a violation is found
*/
void setType(String type, CONSTS_JDOCS.VALIDATION_TYPE validationType);

/**
* Empty the contents of the document
*/
Expand Down Expand Up @@ -521,9 +530,30 @@ public interface Document {
*
* @param type the type of the document
* @throws UnifyException exception containing the list of errors encountered
*
* This method is deprecated - use the new methods validateAllPaths or validateModelPaths
*/
@Deprecated
public void validate(String type);

/**
* validates all data paths in the document against a model and throws an exception if not met
* All validation errors are collected and returned in the exception
*
* @param type the type of the document
* @throws UnifyException exception containing the list of errors encountered
*/
public void validateAllPaths(String type);

/**
* validates only those data paths in the document that are found in the model and throws an exception if not met
* All validation errors are collected and returned in the exception
*
* @param type the type of the document
* @throws UnifyException exception containing the list of errors encountered
*/
public void validateModelPaths(String type);

/**
* checks if the path passed is a leaf node or not
*
Expand All @@ -534,4 +564,9 @@ public interface Document {
*/
public boolean isLeafNode(String path, String... vargs);

/**
* returns the validation type in effect
*/
public CONSTS_JDOCS.VALIDATION_TYPE getValidationType();

}
Loading

0 comments on commit b295fe3

Please sign in to comment.