From 19cb6ee3dcfa17323db8becfbf645b0a62d1d286 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 16:40:03 -0700 Subject: [PATCH 01/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- tagbase_server/tagbase_server/test/test_ingest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tagbase_server/tagbase_server/test/test_ingest.py b/tagbase_server/tagbase_server/test/test_ingest.py index 10a1bda..fdbe53d 100644 --- a/tagbase_server/tagbase_server/test/test_ingest.py +++ b/tagbase_server/tagbase_server/test/test_ingest.py @@ -8,7 +8,6 @@ class TestIngest(unittest.TestCase): - PG_VERSION = "postgres:9.5" SAMPLE_METADATA_LINES = [ "// global attributes:", "// etag device attributes:", From 9db946d7db9825d2b538309ea6c6c8c238330cee Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 16:47:49 -0700 Subject: [PATCH 02/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2532223..7664a15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: image: jamescooke/openapi-validator:latest options: -v ${{ github.workspace }}:/data run: | - lint-openapi --ruleset openapi.yaml + lint-openapi --ruleset .spectral.yaml openapi.yaml exit $? sonarcloud: name: SonarCloud Analysis From b8d5a11ecad9d02dac0f19cc8061564b2b24048b Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 17:06:11 -0700 Subject: [PATCH 03/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7664a15..e84dd73 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 # Required to mount the Github Workspace to a volume + - name: Install NodeJS and ibm-cloud/openapi-ruleset + uses: actions/setup-node@v3 + with: + node-version: 18 + - run: npm install @ibm-cloud/openapi-ruleset - name: Lint OpenAPI Specification uses: addnab/docker-run-action@v3 with: From ccf822e42742c8f3d365610664566b57939e6967 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 17:17:00 -0700 Subject: [PATCH 04/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- .github/workflows/build.yml | 7 +------ openapi.yaml | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e84dd73..39c55bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,11 +15,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 # Required to mount the Github Workspace to a volume - - name: Install NodeJS and ibm-cloud/openapi-ruleset - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install @ibm-cloud/openapi-ruleset - name: Lint OpenAPI Specification uses: addnab/docker-run-action@v3 with: @@ -28,7 +23,7 @@ jobs: image: jamescooke/openapi-validator:latest options: -v ${{ github.workspace }}:/data run: | - lint-openapi --ruleset .spectral.yaml openapi.yaml + lint-openapi openapi.yaml exit $? sonarcloud: name: SonarCloud Analysis diff --git a/openapi.yaml b/openapi.yaml index 5fa8cfe..f1a03ff 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -74,7 +74,7 @@ paths: content: application/octet-stream: schema: - description: Compressed binary file containing one or more eTUFF files + description: Compressed binary e.g. zip file containing one or more eTUFF files format: binary maxLength: 1000000000 minLength: 1 @@ -82,7 +82,7 @@ paths: text/plain: schema: description: Plain text eTUFF file - format: text + format: binary maxLength: 1000000000 minLength: 1 type: string From 6250f59721098e1cb58ed86031c97738b1bad2da Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 17:18:22 -0700 Subject: [PATCH 05/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- .spectral.yaml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .spectral.yaml diff --git a/.spectral.yaml b/.spectral.yaml deleted file mode 100644 index 9e99e06..0000000 --- a/.spectral.yaml +++ /dev/null @@ -1,4 +0,0 @@ -extends: '@ibm-cloud/openapi-ruleset' -rules: - #toggled off as this is IBM-specific - request-body-object: off From 6334f40d75eb1b2f94435aa6e76cb505b77aacd9 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 17:25:57 -0700 Subject: [PATCH 06/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- .github/workflows/build.yml | 2 +- .thresholdrc | 3 --- openapi.yaml | 26 +++++++++++++------------- 3 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 .thresholdrc diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39c55bb..6a24534 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: image: jamescooke/openapi-validator:latest options: -v ${{ github.workspace }}:/data run: | - lint-openapi openapi.yaml + lint-openapi --warnings-limit 0 openapi.yaml exit $? sonarcloud: name: SonarCloud Analysis diff --git a/.thresholdrc b/.thresholdrc deleted file mode 100644 index c7fa2e7..0000000 --- a/.thresholdrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "warnings": 0 -} diff --git a/openapi.yaml b/openapi.yaml index f1a03ff..5a94ccb 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -153,7 +153,7 @@ paths: /tags/{tag_id}/subs/{sub_id}: put: description: Update a tag submission - operationId: put_tag + operationId: replace_tag parameters: - $ref: '#/components/parameters/notes' - $ref: '#/components/parameters/tagId' @@ -190,18 +190,6 @@ components: pattern: ^(?!\s*$).+ type: string style: form - notes: - description: Free-form text field where details of submitted eTUFF file for ingest can be provided e.g. submitter name, etuff data contents (tag metadata and measurements + primary position data, or just secondary solution-positional meta/data) - explode: true - in: query - name: notes - required: false - schema: - maxLength: 10000 - minLength: 1 - pattern: ^(?!\s*$).+ - type: string - style: form subId: description: Existing submission id for an existing tag explode: true @@ -218,6 +206,18 @@ components: required: true schema: type: number + notes: + description: Free-form text field where details of submitted eTUFF file for ingest can be provided e.g. submitter name, etuff data contents (tag metadata and measurements + primary position data, or just secondary solution-positional meta/data) + explode: true + in: query + name: notes + required: false + schema: + maxLength: 10000 + minLength: 1 + pattern: ^(?!\s*$).+ + type: string + style: form type: description: Type of file to be ingested, defaults to 'etuff' explode: true From 3d532b4a1ad3a6a4e2a69946a7e8fd538ee51ca5 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 17:38:59 -0700 Subject: [PATCH 07/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5a94ccb..07e3742 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -155,9 +155,9 @@ paths: description: Update a tag submission operationId: replace_tag parameters: - - $ref: '#/components/parameters/notes' - - $ref: '#/components/parameters/tagId' - $ref: '#/components/parameters/subId' + - $ref: '#/components/parameters/tagId' + - $ref: '#/components/parameters/notes' - $ref: '#/components/parameters/version' responses: "200": From 7f6eaff96f1d5ef5e0398a4213462c9917a8931e Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 17:48:10 -0700 Subject: [PATCH 08/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 69 ++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 07e3742..3304cfe 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -56,7 +56,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Response500' + $ref: '#/components/schemas/ErrorContainer' description: Internal tagbase-server error. Contact admin detailed in openapi.yaml. summary: Get network accessible file and execute ingestion tags: @@ -99,7 +99,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Response500' + $ref: '#/components/schemas/ErrorContainer' description: Internal tagbase-server error. Contact admin detailed in openapi.yaml. summary: Post a local file and perform a ingest operation tags: @@ -121,7 +121,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Response500' + $ref: '#/components/schemas/ErrorContainer' description: Internal tagbase-server error. Contact admin detailed in openapi.yaml. summary: Get information about all tags tags: @@ -144,7 +144,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Response500' + $ref: '#/components/schemas/ErrorContainer' description: Internal tagbase-server error. Contact admin detailed in openapi.yaml. summary: Get information about an individual tag tags: @@ -170,7 +170,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Response500' + $ref: '#/components/schemas/ErrorContainer' description: Internal tagbase-server error. Contact admin detailed in openapi.yaml. summary: Update the 'notes' and/or 'version' associated with a tag submission tags: @@ -249,6 +249,38 @@ components: example: "eTUFF-sailfish-117259_2.txt" title: filename type: string + ErrorContainer: + description: 'An error response for an operation.' + type: object + properties: + error: + $ref: '#/components/schemas/Error' + trace: + description: 'The error trace information.' + example: 123e4567-e89b-12d3-a456-426614174000 + format: uuid + type: string + Error: + description: An error response entry. + example: + code: "500" + message: Unable to connect to the Tagbase database + more_info: https://httpwg.org/specs/rfc7231.html#status.500 + properties: + code: + description: HTTP status code + example: "500" + type: string + message: + description: A string detailing specifics of the error response + example: Data file eTUFF-sailfish-117259.txt ingestion unsuccessful. + type: string + more_info: + description: Additional details (if available) to diagnose. + example: https://httpwg.org/specs/rfc7231.html#status.500 + type: string + title: Response500 + type: object Ingest200: description: HTTP 200 success response example: @@ -271,33 +303,6 @@ components: type: string title: Ingest200 type: object - Response500: - description: 500 Internal Server Error - example: - code: "200" - message: Unable to connect to the Tagbase database - more_info: https://httpwg.org/specs/rfc7231.html#status.500 - trace: 123e4567-e89b-12d3-a456-426614174000 - properties: - code: - description: HTTP status code - example: "200" - type: string - message: - description: A string detailing specifics of the HTTP 500 response - example: Data file eTUFF-sailfish-117259.txt successfully ingested into - Tagbase DB. - type: string - more_info: - description: Additional details (if available) to diagnose the 500 response. - example: https://httpwg.org/specs/rfc7231.html#status.500 - type: string - trace: - description: Trace diagnostic information related to the response - example: 123e4567-e89b-12d3-a456-426614174000 - type: string - title: Response500 - type: object Tag200: description: Information for a given tag example: From 16e7aff87caa34aa54d5368dfcc75235d030fac0 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 18:10:28 -0700 Subject: [PATCH 09/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 3304cfe..5fd0816 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -253,34 +253,34 @@ components: description: 'An error response for an operation.' type: object properties: - error: - $ref: '#/components/schemas/Error' + errors: + type: array + minItems: 0, + maxItems: 100, + description: 'The array of error entries associated with the error response', + items: + $ref: '#/components/schemas/Error' trace: description: 'The error trace information.' example: 123e4567-e89b-12d3-a456-426614174000 format: uuid type: string Error: - description: An error response entry. - example: - code: "500" - message: Unable to connect to the Tagbase database - more_info: https://httpwg.org/specs/rfc7231.html#status.500 + description: 'An error response entry.' + type: object properties: code: - description: HTTP status code - example: "500" + description: 'The error code.' type: string + enum: + - '500' + - '501' message: - description: A string detailing specifics of the error response - example: Data file eTUFF-sailfish-117259.txt ingestion unsuccessful. + description: 'The error message.' type: string more_info: - description: Additional details (if available) to diagnose. - example: https://httpwg.org/specs/rfc7231.html#status.500 + description: 'Additional info about the error.' type: string - title: Response500 - type: object Ingest200: description: HTTP 200 success response example: From 5f2cceb333332a29f050e1881682321fde9453f2 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 21:08:26 -0700 Subject: [PATCH 10/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5fd0816..16633af 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -255,9 +255,9 @@ components: properties: errors: type: array - minItems: 0, - maxItems: 100, - description: 'The array of error entries associated with the error response', + minItems: 0 + maxItems: 100 + description: 'The array of error entries associated with the error response' items: $ref: '#/components/schemas/Error' trace: From 9d7ceec1145b410e489ae7b959c619ee31fc581f Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 21:15:15 -0700 Subject: [PATCH 11/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 16633af..682666b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -273,8 +273,10 @@ components: description: 'The error code.' type: string enum: - - '500' - - '501' + - 'internal_server_error' + - 'bad_request' + - 'unauthorized' + - 'service_unavilable' message: description: 'The error message.' type: string From 1dd160280c613f70899fee9707dfd10cdaa7b3aa Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Wed, 5 Apr 2023 21:20:35 -0700 Subject: [PATCH 12/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openapi.yaml b/openapi.yaml index 682666b..be8b20b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -374,6 +374,8 @@ components: description: Version identifier for the eTUFF tag data file ingested example: "1" type: string + minItems: 0 + maxItems: 100 type: array title: Tag200 type: object From 3ec7162b252187b6b9691549fa513729b2415062 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Thu, 6 Apr 2023 07:00:58 -0700 Subject: [PATCH 13/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 78 +++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index be8b20b..300f18b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -337,43 +337,7 @@ components: tag: description: List containing one or more submissions for a given tag items: - type: object - properties: - date_time: - description: Local datetime stamp at the time of eTUFF tag data file ingestion - example: '2022-04-01T04:58:21.319061+00:00' - #format: date - #pattern: '^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$' - type: string - filename: - $ref: '#/components/schemas/filename' - metadata: - description: Contains the ingested tag metadata consistent with the eTUFF specification - example: - person_owner: John Do - owner_contect: john@do.net - manufacturer: telemetry inc. - model: new_gen - attachment_method: anchor - type: object - additionalProperties: - type: string - notes: - description: Free-form text field where details of submitted eTUFF file for ingest can be provided e.g. submitter name, etuff data contents (tag metadata and measurements + primary position data, or just secondary solutionpositional meta/data) - example: "Ingested by admin on XXXX-XX-XX to back-process campaign XYZ." - type: string - submission_id: - description: Unique numeric ID assigned upon submission of a tag eTUFF data file for ingest/importation into Tagbase - example: 5 - type: integer - tag_id: - description: Unique numeric Tag ID associated with the ingested tag eTUFF data file - example: 3 - type: integer - version: - description: Version identifier for the eTUFF tag data file ingested - example: "1" - type: string + $ref: '#/components/schemas/TagSubmission' minItems: 0 maxItems: 100 type: array @@ -395,6 +359,44 @@ components: type: string title: TagPut200 type: object + TagSubmission: + type: object + properties: + date_time: + description: Local datetime stamp at the time of eTUFF tag data file ingestion + example: '2022-04-01T04:58:21.319061+00:00' + #format: date + #pattern: '^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$' + type: string + filename: + $ref: '#/components/schemas/filename' + metadata: + description: Contains the ingested tag metadata consistent with the eTUFF specification + example: + person_owner: John Do + owner_contect: john@do.net + manufacturer: telemetry inc. + model: new_gen + attachment_method: anchor + type: object + additionalProperties: + type: string + notes: + description: Free-form text field where details of submitted eTUFF file for ingest can be provided e.g. submitter name, etuff data contents (tag metadata and measurements + primary position data, or just secondary solutionpositional meta/data) + example: "Ingested by admin on XXXX-XX-XX to back-process campaign XYZ." + type: string + submission_id: + description: Unique numeric ID assigned upon submission of a tag eTUFF data file for ingest/importation into Tagbase + example: 5 + type: integer + tag_id: + description: Unique numeric Tag ID associated with the ingested tag eTUFF data file + example: 3 + type: integer + version: + description: Version identifier for the eTUFF tag data file ingested + example: "1" + type: string Tags200: description: Response detailing all available unique tags and associated filename example: @@ -427,5 +429,7 @@ components: example: eTUFF-sailfish-117259.txt type: string type: object + minItems: 0 + maxItems: 100000 title: Tags200 type: object From 64ea9049f5e32ab706a366198aa921481eccfbb8 Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Thu, 6 Apr 2023 07:26:46 -0700 Subject: [PATCH 14/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 53 ++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 300f18b..493ba40 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -249,6 +249,10 @@ components: example: "eTUFF-sailfish-117259_2.txt" title: filename type: string + tag_id: + description: Unique numeric Tag ID associated with the ingested tag eTUFF data file + example: 3 + type: integer ErrorContainer: description: 'An error response for an operation.' type: object @@ -305,6 +309,17 @@ components: type: string title: Ingest200 type: object + Metadata: + description: Contains the ingested tag metadata consistent with the eTUFF specification + example: + person_owner: John Do + owner_contect: john@do.net + manufacturer: telemetry inc. + model: new_gen + attachment_method: anchor + type: object + additionalProperties: + type: string Tag200: description: Information for a given tag example: @@ -359,6 +374,17 @@ components: type: string title: TagPut200 type: object + Tag: + description: Unique numeric Tag ID associated with the ingested tag eTUFF data file + example: + tag_id: 1 + filename: eTUFF-sailfish-117259_2.txt + properties: + tag_id: + $ref: '#/components/schemas/tag_id' + filename: + $ref: '#/components/schemas/filename' + type: object TagSubmission: type: object properties: @@ -371,16 +397,7 @@ components: filename: $ref: '#/components/schemas/filename' metadata: - description: Contains the ingested tag metadata consistent with the eTUFF specification - example: - person_owner: John Do - owner_contect: john@do.net - manufacturer: telemetry inc. - model: new_gen - attachment_method: anchor - type: object - additionalProperties: - type: string + $ref: '#/components/schemas/Metadata' notes: description: Free-form text field where details of submitted eTUFF file for ingest can be provided e.g. submitter name, etuff data contents (tag metadata and measurements + primary position data, or just secondary solutionpositional meta/data) example: "Ingested by admin on XXXX-XX-XX to back-process campaign XYZ." @@ -390,6 +407,7 @@ components: example: 5 type: integer tag_id: + $ref: '#/components/schemas/tag_id' description: Unique numeric Tag ID associated with the ingested tag eTUFF data file example: 3 type: integer @@ -415,20 +433,7 @@ components: description: List of unique numeric Tag IDs and associated filename type: array items: - description: Unique numeric Tag ID associated with the ingested tag eTUFF data file - example: - tag_id: 1 - filename: eTUFF-sailfish-117259_2.txt - properties: - tag_id: - description: Unique numeric Tag ID associated with the ingested tag data file - example: 1 - type: integer - filename: - description: Full name and extension of the ingested eTUFF tag data file - example: eTUFF-sailfish-117259.txt - type: string - type: object + $ref: '#/components/schemas/Tag' minItems: 0 maxItems: 100000 title: Tags200 From f1d2c504ae79cd8337e3a0898ea9fe0eac10322b Mon Sep 17 00:00:00 2001 From: Lewis John McGibbney Date: Thu, 6 Apr 2023 07:28:18 -0700 Subject: [PATCH 15/15] ISSUE-205 Is TestIngest PG_VERSION Class Variable required? --- openapi.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 493ba40..d7259f7 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -408,9 +408,6 @@ components: type: integer tag_id: $ref: '#/components/schemas/tag_id' - description: Unique numeric Tag ID associated with the ingested tag eTUFF data file - example: 3 - type: integer version: description: Version identifier for the eTUFF tag data file ingested example: "1"