Skip to content

Commit

Permalink
Merge pull request #7 from nationalarchives/update_readme
Browse files Browse the repository at this point in the history
Update the readme file
  • Loading branch information
vimleshtna authored Oct 27, 2023
2 parents 1430008 + 4157096 commit 002bd9c
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 and 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 002bd9c

Please sign in to comment.