From 5eb797d15259ba40fa8e332d6dbc35c8252ab950 Mon Sep 17 00:00:00 2001 From: Douglas Lowe <10961945+douglowe@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:09:43 +0100 Subject: [PATCH 1/9] first API doc --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/README.md b/README.md index b1de0e9..52d23de 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,48 @@ This project presents a Flask-based API for validating RO-Crates. +## API + +#### Request Validation of RO-Crate + +#### Get RO-Crate Validation Result + +#### Validate RO-Crate Metadata + +
+ POST / (validates submitted RO-Crate Metadata) + +##### Parameters + +> | 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 | + + +##### Responses + +> | http code | content-type | response | +> |---------------|-----------------------------------|---------------------------------------------------------------------| +> | `200` | `application/json` | `Successful Validation` | +> | `422` | `application/json` | `Error: Details of Validation Error` | + +##### Example cURL + +> ```javascript +> 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'\''}" +> }' +> ``` + +
+ + + ## Project Structure ``` From be6c1d41d3b8ddb92e5b08886fee5f00229d5aef Mon Sep 17 00:00:00 2001 From: Douglas Lowe <10961945+douglowe@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:10:57 +0100 Subject: [PATCH 2/9] metadata path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52d23de..4401f69 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This project presents a Flask-based API for validating RO-Crates. #### Validate RO-Crate Metadata
- POST / (validates submitted RO-Crate Metadata) + POST v1/ro_crates/validate_metadata (validates submitted RO-Crate Metadata) ##### Parameters From b1f4fb3dd1c37077d162b48247b49e66f5637770 Mon Sep 17 00:00:00 2001 From: Douglas Lowe <10961945+douglowe@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:38:56 +0100 Subject: [PATCH 3/9] post and get api --- README.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/README.md b/README.md index 4401f69..491c429 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,114 @@ This project presents a Flask-based API for validating RO-Crates. #### Request Validation of RO-Crate +
+ POST v1/ro_crates/{crate_id}/validation (Request validation of RO-Crate validation in Object Store) + +##### Path Parameters + +> | name | type | data type | description | +> |------------|-----------|-------------------------|-----------------------------------------------------------------------| +> | crate_id | required | string | RO-Crate identifer string | + +##### Parameters + +> | 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 | +> | 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 | + +##### Responses + +> | http code | content-type | response | +> |---------------|-----------------------------------|---------------------------------------------------------------------| +> | `202` | `application/json` | `{"message": "Validation in progress"}` | +> | `400` | `application/json` | `{"message": "No RO-Crate with prefix: "}` | +> | `500` | `application/json` | `{"message": "Internal server errors"}` | + +> ```javascript +> curl -X 'POST' \ +> 'http://localhost:5001/v1/ro_crates//validation' \ +> -H 'accept: application/json' \ +> -H 'Content-Type: application/json' \ +> -d '{ +> "minio_config": { +> "accesskey": "", +> "bucket": "ro-crates", +> "endpoint": "minio:9000", +> "secret": "", +> "ssl": false +> }, +> "profile_name": "", +> "webhook_url": "" +> }' +> ``` + + #### Get RO-Crate Validation Result +
+ GET v1/ro_crates/{crate_id}/validation (Obtain RO-Crate validation result from Object Store) + +##### Path Parameters + +> | name | type | data type | description | +> |------------|-----------|-------------------------|-----------------------------------------------------------------------| +> | crate_id | required | string | RO-Crate identifer string | + +##### Parameters + +> | 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 | + +##### Responses + +> | http code | content-type | response | +> |---------------|-----------------------------------|---------------------------------------------------------------------| +> | `200` | `application/json` | `Successful Validation` | +> | `422` | `application/json` | `Error: Details of Validation Error` | +> | `404` | `application/json` | `Not found` | + +##### Example cURL + +> ```javascript +> curl -X 'GET' \ +> 'http://localhost:5001/v1/ro_crates//validation' \ +> -H 'accept: application/json' \ +> -H 'Content-Type: application/json' \ +> -d '{ +> "minio_config": { +> "accesskey": "", +> "bucket": "ro-crates", +> "endpoint": "minio:9000", +> "secret": "", +> "ssl": false +> } +> }' +> ``` + +
+ #### Validate RO-Crate Metadata
From 4356de86ead25122e82a75b10231e001f563a45d Mon Sep 17 00:00:00 2001 From: Douglas Lowe <10961945+douglowe@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:40:23 +0100 Subject: [PATCH 4/9] correct formatting --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 491c429..33c2e5c 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ This project presents a Flask-based API for validating RO-Crates. > }' > ``` +
+ #### Get RO-Crate Validation Result From 5ea8befce87bbb7dfd4c5116a137e40855616d68 Mon Sep 17 00:00:00 2001 From: Douglas Lowe <10961945+douglowe@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:41:21 +0100 Subject: [PATCH 5/9] remove old example usage --- README.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/README.md b/README.md index 33c2e5c..22844cb 100644 --- a/README.md +++ b/README.md @@ -217,23 +217,3 @@ For testing locally developed containers use the alternate Docker Compose file: ```bash docker compose --file docker-compose-develop.yml up --build ``` - -## Example Usage - -Submission of validation of RO-Crate with the ID of `ro_crate_1`. No webhook is used here: -```bash -curl -X 'POST' \ - 'http://localhost:5001/ro_crates/v1/ro_crate_1/validation' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{}' -``` - -Retrieval of validation result for RO-Crate `ro_crate_1`: -```bash -curl -X 'GET' \ - 'http://localhost:5001/ro_crates/v1/ro_crate_1/validation' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{}' -``` From 70d91c65540aac5abe04d5319f1e1469784f0247 Mon Sep 17 00:00:00 2001 From: Douglas Lowe <10961945+douglowe@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:43:45 +0100 Subject: [PATCH 6/9] test alternate display --- README.md | 75 +++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 22844cb..c0ac3e6 100644 --- a/README.md +++ b/README.md @@ -123,55 +123,34 @@ This project presents a Flask-based API for validating RO-Crates. ##### Parameters -> | 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 | +| 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 | ##### Responses -> | http code | content-type | response | -> |---------------|-----------------------------------|---------------------------------------------------------------------| -> | `200` | `application/json` | `Successful Validation` | -> | `422` | `application/json` | `Error: Details of Validation Error` | +| http code | content-type | response | +|---------------|-----------------------------------|---------------------------------------------------------------------| +| `200` | `application/json` | `Successful Validation` | +| `422` | `application/json` | `Error: Details of Validation Error` | ##### Example cURL -> ```javascript -> 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'\''}" -> }' -> ``` +```javascript + 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'\''}" + }' +```
- -## Project Structure - -``` -app/ -├── 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 -``` - ## Setting up the project ### Prerequisites @@ -217,3 +196,23 @@ For testing locally developed containers use the alternate Docker Compose file: ```bash docker compose --file docker-compose-develop.yml up --build ``` + +### Project Structure + +``` +app/ +├── 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 +``` \ No newline at end of file From d79b388efdbd905398bcc59ea7beafa0cd7748aa Mon Sep 17 00:00:00 2001 From: Douglas Lowe <10961945+douglowe@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:51:47 +0100 Subject: [PATCH 7/9] removed more indenting --- README.md | 116 +++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index c0ac3e6..98d4322 100644 --- a/README.md +++ b/README.md @@ -11,17 +11,17 @@ This project presents a Flask-based API for validating RO-Crates. ##### Path Parameters -> | name | type | data type | description | -> |------------|-----------|-------------------------|-----------------------------------------------------------------------| -> | crate_id | required | string | RO-Crate identifer string | +| name | type | data type | description | +|------------|-----------|-------------------------|-----------------------------------------------------------------------| +| crate_id | required | string | RO-Crate identifer string | ##### Parameters -> | 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 | -> | minio_config | required | dictionary | MinIO Configuration Details | +| 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 | +| minio_config | required | dictionary | MinIO Configuration Details | `minio_config` > | name | type | data type | description | @@ -34,29 +34,29 @@ This project presents a Flask-based API for validating RO-Crates. ##### Responses -> | http code | content-type | response | -> |---------------|-----------------------------------|---------------------------------------------------------------------| -> | `202` | `application/json` | `{"message": "Validation in progress"}` | -> | `400` | `application/json` | `{"message": "No RO-Crate with prefix: "}` | -> | `500` | `application/json` | `{"message": "Internal server errors"}` | - -> ```javascript -> curl -X 'POST' \ -> 'http://localhost:5001/v1/ro_crates//validation' \ -> -H 'accept: application/json' \ -> -H 'Content-Type: application/json' \ -> -d '{ -> "minio_config": { -> "accesskey": "", -> "bucket": "ro-crates", -> "endpoint": "minio:9000", -> "secret": "", -> "ssl": false -> }, -> "profile_name": "", -> "webhook_url": "" -> }' -> ``` +| http code | content-type | response | +|---------------|-----------------------------------|---------------------------------------------------------------------| +| `202` | `application/json` | `{"message": "Validation in progress"}` | +| `400` | `application/json` | `{"message": "No RO-Crate with prefix: "}` | +| `500` | `application/json` | `{"message": "Internal server errors"}` | + +```javascript +curl -X 'POST' \ + 'http://localhost:5001/v1/ro_crates//validation' \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -d '{ + "minio_config": { + "accesskey": "", + "bucket": "ro-crates", + "endpoint": "minio:9000", + "secret": "", + "ssl": false + }, + "profile_name": "", + "webhook_url": "" +}' +```
@@ -68,16 +68,16 @@ This project presents a Flask-based API for validating RO-Crates. ##### Path Parameters -> | name | type | data type | description | -> |------------|-----------|-------------------------|-----------------------------------------------------------------------| -> | crate_id | required | string | RO-Crate identifer string | +| name | type | data type | description | +|------------|-----------|-------------------------|-----------------------------------------------------------------------| +| crate_id | required | string | RO-Crate identifer string | ##### Parameters -> | name | type | data type | description | -> |------------|-----------|-------------------------|-----------------------------------------------------------------------| -> | root_path | optional | string | Root path which contains the RO-Crate | -> | minio_config | required | dictionary | MinIO Configuration Details | +| 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 | @@ -90,29 +90,29 @@ This project presents a Flask-based API for validating RO-Crates. ##### Responses -> | http code | content-type | response | -> |---------------|-----------------------------------|---------------------------------------------------------------------| -> | `200` | `application/json` | `Successful Validation` | -> | `422` | `application/json` | `Error: Details of Validation Error` | -> | `404` | `application/json` | `Not found` | +| http code | content-type | response | +|---------------|-----------------------------------|---------------------------------------------------------------------| +| `200` | `application/json` | `Successful Validation` | +| `422` | `application/json` | `Error: Details of Validation Error` | +| `404` | `application/json` | `Not found` | ##### Example cURL -> ```javascript -> curl -X 'GET' \ -> 'http://localhost:5001/v1/ro_crates//validation' \ -> -H 'accept: application/json' \ -> -H 'Content-Type: application/json' \ -> -d '{ -> "minio_config": { -> "accesskey": "", -> "bucket": "ro-crates", -> "endpoint": "minio:9000", -> "secret": "", -> "ssl": false -> } -> }' -> ``` +```javascript + curl -X 'GET' \ + 'http://localhost:5001/v1/ro_crates//validation' \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -d '{ + "minio_config": { + "accesskey": "", + "bucket": "ro-crates", + "endpoint": "minio:9000", + "secret": "", + "ssl": false + } +}' +``` From 345763673354f65d488d4b08c5246ff44610cc61 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 23:41:41 +0000 Subject: [PATCH 8/9] Bump flask from 3.0.3 to 3.1.2 Bumps [flask](https://github.com/pallets/flask) from 3.0.3 to 3.1.2. - [Release notes](https://github.com/pallets/flask/releases) - [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/flask/compare/3.0.3...3.1.2) --- updated-dependencies: - dependency-name: flask dependency-version: 3.1.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 79fd9f4..cbc7f68 100644 --- a/requirements.in +++ b/requirements.in @@ -1,7 +1,7 @@ celery==5.5.3 minio==7.2.16 requests==2.32.4 -Flask==3.0.3 +Flask==3.1.2 Werkzeug==3.1.3 redis==6.4.0 python-dotenv==1.1.1 diff --git a/requirements.txt b/requirements.txt index 8ddc396..f8b0752 100644 --- a/requirements.txt +++ b/requirements.txt @@ -53,7 +53,7 @@ colorlog==6.9.0 # via roc-validator enum-tools==0.12.0 # via roc-validator -flask==3.0.3 +flask==3.1.2 # via # -r requirements.in # apiflask @@ -83,6 +83,7 @@ markdown-it-py==3.0.0 # via rich markupsafe==3.0.2 # via + # flask # jinja2 # werkzeug marshmallow==4.0.0 From 24fc940d6e13e68a36ee8097af98f443a78ab32b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 08:56:14 +0000 Subject: [PATCH 9/9] Bump requests from 2.32.4 to 2.32.5 Bumps [requests](https://github.com/psf/requests) from 2.32.4 to 2.32.5. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.32.4...v2.32.5) --- updated-dependencies: - dependency-name: requests dependency-version: 2.32.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index cbc7f68..a2e7a54 100644 --- a/requirements.in +++ b/requirements.in @@ -1,6 +1,6 @@ celery==5.5.3 minio==7.2.16 -requests==2.32.4 +requests==2.32.5 Flask==3.1.2 Werkzeug==3.1.3 redis==6.4.0 diff --git a/requirements.txt b/requirements.txt index f8b0752..13fd7ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -136,7 +136,7 @@ rdflib[html]==7.1.4 # roc-validator redis==6.4.0 # via -r requirements.in -requests==2.32.4 +requests==2.32.5 # via # -r requirements.in # requests-cache