A number of tools are provided with RADAR-Schemas. They are most easily accessed by using the docker image as described in the main readme. Below is more information about the schema validation that the tools can perform.
The RADAR Schemas Validator checks if the Schema Catalog is in a valid state.
It first checks the folder structure, it has to be compliant with:
- commons
- active
- catalogue
- kafka
- monitor
- passive
- stream
- rest
- specification
- active
- monitor
- passive
- stream
For each Avro schema under commons folder checks if:
- in case of
ENUM- the
namespacediffers from null and it is a lowercase string dot separated without numeric - the
namematches the .avsc file name and it is an UpperCamelCase string - there is documentation
symbolsmatchUPPER_CASEformat
- the
- in case of
RECORD- the
namespacediffers from null and it is a lowercase string dot separated without numeric - the
namematches the .avsc file name and it is an UpperCamelCase string - fields is not empty
- the
field nameis a lowerCamelCase string and does not contain string such asvalue,Value. - schemas under
activefolder havetimeandtimeCompletedfields, and do not contain a field namedtimeReceived - schemas under
monitorfolder havetimefield, and do not contain a field named eithertimeCompletedortimeReceived - schemas under
passivefolder havetimeandtimeReceivedfields, and do not have a field namedtimeCompleted - the record and any provided fields are documented
ENUMfields haveUNKNOWNasdefaultvalue, if anynullable/optionalfields havenullas default value
- the
Upon rule violation, the end user is notified with a message explaining how to fix it.
The validation is implemented as a JUnit test. To run the validation, simply type ./gradlew test
Record name and field name validations can be suppressed modifying the skip configuration file.
files lists file paths that can be ignored. It can contain values like
- entire path like
commons/active/questionnaire/questionnaire.avsc - folder and subfolder
commons/active/**/*: all file underactiveand all its subfolder will be skipped - folder and subfolder
commons/active/**/*.avsc: all file with formatavscunderactiveand all its subfolder will be skipped - file name
.DS_Store: all file named.DS_Storewill be skipped - file extension
*.md: all file with extension*.mdwill be skipped
files:
- path/to/avoid/README.md
- path/to/**/*
- path/to/**/README.md
- .DS_Store
- *.mdvalidation allows the user to specify checks that should be skipped at schema level:
- a key like
org.radarcns.passive.biovotion.*set a skip configuration valid for all schemas underorg.radarcns.passive.biovotionpackage - a key like
org.radarcns.passive.biovotion.BiovotionVSMSpO2specify a configuration valid only for the given record name_record_check: DISABLEsuppresses the record name checkfieldslists field names for which the field name check is suppressed All tests are enable by default.
validation:
org.radarcns.passive.biovotion.BiovotionVSMSpO2:
- fields:
- fieldnameOne
- fieldnameTwo