This project presents a Flask-based API for validating RO-Crates.
The RO-Crate Validation Service can validate an RO-Crate's metadata directly from a JSON payload (the POST v1/ro_crates/validate_metadata endpoint) without storing anything. This is the default mode.
Optionally, the service can read crates from β and write validation results
back to β a MinIO object store. This is disabled by
default and controlled by the MINIO_ENABLED environment variable:
MINIO_ENABLED=false(default): only a stateless validation endpoint is available and nothing is stored.MINIO_ENABLED=true: the ID endpoints (POST/GET v1/ro_crates/{crate_id}/validation) are also registered, and a MinIO instance is required. With Docker Compose, start MinIO with its opt-in profile:docker compose --profile minio up.
When MinIO is disabled the ID-based endpoints are not registered and return 404.
POST v1/ro_crates/{crate_id}/validation (Request validation of RO-Crate validation in Object Store)
| name | type | data type | description |
|---|---|---|---|
| crate_id | required | string | RO-Crate identifer string |
| name | type | data type | description |
|---|---|---|---|
| root_path | optional | string | Root path which contains the RO-Crate |
| webhook_url | optional | string | Webhook to send validation result to |
| profile_name | optional | string | RO-Crate profile to validate against |
| minio_config | required | dictionary | MinIO Configuration Details |
minio_config
name type data type description endpoint required string MinIO endpoint accesskey required string MinIO access key or username secret required string MinIO secret or password ssl required boolean Use SSL encryption for MinIO access? bucket required string MinIO bucket containing RO-Crate
| http code | content-type | response |
|---|---|---|
202 |
application/json |
{"message": "Validation in progress"} |
400 |
application/json |
{"message": "No RO-Crate with prefix: <crate_id>"} |
500 |
application/json |
{"message": "Internal server errors"} |
curl -X 'POST' \
'http://localhost:5001/v1/ro_crates/<crate_id>/validation' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"minio_config": {
"accesskey": "<key>",
"bucket": "ro-crates",
"endpoint": "minio:9000",
"secret": "<secret>",
"ssl": false
},
"profile_name": "<profile>",
"webhook_url": "<webhook>"
}'GET v1/ro_crates/{crate_id}/validation (Obtain RO-Crate validation result from Object Store)
| name | type | data type | description |
|---|---|---|---|
| crate_id | required | string | RO-Crate identifer string |
| name | type | data type | description |
|---|---|---|---|
| root_path | optional | string | Root path which contains the RO-Crate |
| minio_config | required | dictionary | MinIO Configuration Details |
minio_config
name type data type description endpoint required string MinIO endpoint accesskey required string MinIO access key or username secret required string MinIO secret or password ssl required boolean Use SSL encryption for MinIO access? bucket required string MinIO bucket containing RO-Crate
| http code | content-type | response |
|---|---|---|
200 |
application/json |
Successful Validation |
422 |
application/json |
Error: Details of Validation Error |
404 |
application/json |
Not found |
curl -X 'GET' \
'http://localhost:5001/v1/ro_crates/<crate_id>/validation' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"minio_config": {
"accesskey": "<key>",
"bucket": "ro-crates",
"endpoint": "minio:9000",
"secret": "<secret>",
"ssl": false
}
}'POST v1/ro_crates/validate_metadata (validates submitted RO-Crate Metadata)
| name | type | data type | description |
|---|---|---|---|
| crate_json | required | string | RO-Crate metadata, stored as a single string |
| profile_name | optional | string | RO-Crate profile to validate against |
| http code | content-type | response |
|---|---|---|
200 |
application/json |
Successful Validation |
422 |
application/json |
Error: Details of Validation Error |
curl -X 'POST' \
'http://localhost:5001/v1/ro_crates/validate_metadata' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"crate_json": "{'\''test1'\'':'\''test2'\''}"
}'- Docker with Docker Compose
-
Clone the repository:
git clone https://github.com/eScienceLab/Cratey-Validator.git cd crate-validation-service -
Create the
.envfile for shared environment information. An example environment file is included (example.env), which can be copied for this purpose. But make sure to change any security settings (username and passwords). -
A directory containing RO-Crate profiles to replace the default RO-Crate profiles for validation may be provided. Note that this will need to contain all profile files, as the default profile data will not be used. An example of this is given in the
docker-compose-develop.ymlfile, and described here:- Store the profiles in a convenient directory, e.g.:
./local/rocrate_validator_profiles - Add a volume to the celery worker container for these, e.g.:
volumes: - ./local/rocrate_validator_profiles:/app/profiles:ro- Provide the
PROFILES_PATHenvironment to the flask container (not the celery worker container) to match the internal path, e.g.:
- PROFILES_PATH=/app/profiles - Store the profiles in a convenient directory, e.g.:
-
Build and start the services using Docker Compose:
docker compose up --build
This runs in the default (metadata-only) mode. To enable the MinIO-backed endpoints, set
MINIO_ENABLED=truein your.envand start theminioprofile:docker compose --profile minio up --build
-
(Only when
MINIO_ENABLED=true) Set up the MinIO bucket-
Open the MinIO web interface at
http://localhost:9000. -
Log in with your MinIO credentials.
-
Create a new bucket named
ro-crates. -
Enable versioning for the
ro-cratesbucket β this is important for tracking unique object versions. -
Upload your RO-Crate files to the
ro-cratesbucket. -
To verify that versioning is enabled:
- Select the uploaded RO-Crate object in the
ro-cratesbucket. - Navigate to the Actions panel on the right.
- The Display Object Versions option should be clickable.
- Select the uploaded RO-Crate object in the
-
For standard usage the Docker Compose script uses prebuilt containers. For testing locally developed containers use the alternate Docker Compose file:
docker compose --file docker-compose-develop.yml up --buildapp/
βββ ro_crates/
β βββ routes/
β β βββ __init__.py # Registers blueprints
β β βββ post_routes.py # POST API routes
β βββ __init__.py
βββ services/
β βββ logging_service.py # Centralised logging
β βββ validation_service.py # Queue RO-Crates for validation
βββ tasks/
β βββ validation_tasks.py # Validate RO-Crates
βββ utils/
β βββ config.py # Configuration
β βββ minio_utils.py # Methods for interacting with MinIO
β βββ webhook_utils.py # Methods for sending webhooks

