Create JSON-schema specification file
Format
A format proposal can be found here. But the schema should be attribute-aware.
Typed JSON -> untyped model is ok (see here). The other direction require:
- only using strings but with regexp for integers and float
the use of a validator supporting loose typing (such as json-schema-validator)the json converter should take the json schema as input and convert string to integers/float.
Decision: We work exclusively with untyped data (i.e. strings). This is because an integer may be left empty because missing or N/A. In this case the validator would complain. In addition, even a field like sample_depth
, which would likely be modeled as a float, may be expressed as <500
meaning "Less than 500 meters".
Schema bootstrapping
The easiest is to agree on a mock json example which can be use to generate a corresponding JSON schema using an online tool such as this one.
Tasks
-
Bootstrap schema and commit on this repo -
Add Unit test checking that the generated JSON from a sample CSV is valid according to the JSON schema (https://www.baeldung.com/introduction-to-json-schema-in-java#Validation)
Edited by mma227