Contains JSON schema definitions and samples for Farmsmart Entities
This module is added as a git submodule in the farmsmart-firebase repository to provide on-demand validation of CMS documents.
- Clone farmsmart-firebase repository
- Follow farmsmart-firebase Getting Started guide.
- Edit ./circleci/config.yml
validate
job - Add the validation line like so (for crop)
json validate --schema-file=farmsmart/schemas/crop.schema.json --document-file=farmsmart/json/crop.sample.json
https://json-schema.org/draft-07/json-schema-release-notes.html
Note that schemas should match the schema name from Flamelink, typically this is camelCase e.g. cropStage
Crop - Contains crops
Crop Stage Schema - Stages in a crop. Referenced by Crop
Article - Articles referenced by Crop Stage or other Articles
Use the path segments to build the path to the document in FireStore
Use the path segments to build the path to the image.
Sample Path segments:
"image": [
{
"_path": {
"segments": [
"fl_files",
"fFchw9hkJ8m5u5j2xAuX"
]
}
}
],
In firestore lookup fl_files for the fFchw9hkJ8m5u5j2xAuX to get the available size and the name of the image. Sample JSON of fl_files
{
"sizes": [
{
"width": 1080,
"path": "1080_9999_100",
"quality": 1,
"height": 9999
}
],
"type": "images",
"id": "fFchw9hkJ8m5u5j2xAuX",
"file": "fFchw9hkJ8m5u5j2xAuX_Tomato.JPG",
"contentType": "image/jpeg"
}
From the document build the path to the Firebase Cloud Store
/flamelink/media/sized/1080_9999_100/fFchw9hkJ8m5u5j2xAuX_Tomato.JPG