Skip to content

Commit

Permalink
Update the readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
vimleshtna committed Oct 16, 2023
1 parent c5bc0d1 commit 8c1d8fe
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
# tdr-metadata-validation
# TDR Metadata Validation

This validation library is used to validate closure & descriptive metadata as per the provided metadata criteria.
If the input values have any errors then it will return a list of error codes. You can use the error codes to render the client's specific error messages.

## How to use?

1. Create `MetadataCriteria` for closure or descriptive metadata
2. Create a `MetadataValidation` object with the criteria
3. Now call the validation method (closure or descriptive) with your metadata

Example:
```scala
import uk.gov.nationalarchives.tdr.validation._

val closureMetadataCriteria = MetadataCriteria("ClosureType", Boolean, true, false, false, List("yes", "no"))
val descriptiveMetadataCriteria = List(
MetadataCriteria("Property1", Text, false, false, false, Nil, None, None),
)
val metadataValidation = new MetadataValidation(closureMetadataCriteria, descriptiveMetadataCriteria)

val metadata = List(
Metadata("Property1", ""),
Metadata("Property2", ""),
Metadata("Property3", "test")
)

val closureMetadataErrors = metadataValidation.validateClosureMetadata(metadata)
val descriptiveMetadataErrors = metadataValidation.validateDescriptiveMetadata(metadata)
```

0 comments on commit 8c1d8fe

Please sign in to comment.