Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@ topdir:=$(realpath $(dir $(word $(NUM_OF_PARENT),$(MAKEFILE_LIST))))

all: help

lint-json:
for FILE in $(shell find . -name "*.json"); do docker run -i ghcr.io/jqlang/jq:latest < $$FILE '.' | diff $$FILE -; done

build-lint:
conform-json:
for FILE in $(shell find . -name "*.json"); do docker run -i ghcr.io/jqlang/jq:latest < $$FILE '.' > $$FILE.tmp.json && mv $$FILE.tmp.json $$FILE; done

build-lint-oas:
docker pull --platform linux/amd64 stoplight/spectral:6.10 >/dev/null 2>/dev/null || true
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 -f Dockerfile.multi --target oaslint -t tams_api_oaslint:local .

# Work around https://github.com/stoplightio/spectral/issues/2819 using the bundled spec
lint: build-lint docs/TimeAddressableMediaStore_bundled.yaml
lint-oas: build-lint-oas docs/TimeAddressableMediaStore_bundled.yaml
docker run --platform linux/amd64 --rm -v $(topdir):/api tams_api_oaslint:local lint --fail-severity=warn /api/docs/TimeAddressableMediaStore_bundled.yaml

lint: lint-oas lint-json

build-bundle:
docker pull redocly/cli:latest >/dev/null 2>/dev/null || true
DOCKER_BUILDKIT=1 docker build -f Dockerfile.multi --target bundle -t tams_api_bundle:local .

docs/TimeAddressableMediaStore_bundled.yaml: build-bundle
docker run --rm tams_api_bundle:local bundle /data/TimeAddressableMediaStore.yaml > $@
docker run --rm tams_api_bundle:local bundle /data/TimeAddressableMediaStore.yaml > $@

render: docs/TimeAddressableMediaStore_bundled.yaml

Expand All @@ -37,10 +44,11 @@ mock-server-healthy:

help:
@echo "tams-api"
@echo "make lint - Lint API specification document"
@echo "make lint - Lint API specification document, and json files"
@echo "make conform-json - Conform JSON files to linter"
@echo "make render - Generate HTML rendered version of OpenAPI document"
@echo "make mock-server-up - Start a mock API server on http://localhost:4010"
@echo "make mock-server-down - Stop the mock API server"
@echo "make mock-server-healthy - Connect to mock API server, confirm it is working"

.PHONY: all build-lint lint build-bundle render mock-server-up mock-server-down mock-server-healthy help
.PHONY: all lint-json conform-json build-lint-oas lint-oas lint build-bundle render mock-server-up mock-server-down mock-server-healthy help
22 changes: 11 additions & 11 deletions api/examples/deletion-request-get-200.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"id": "9f0187c1-419c-44d2-8269-e869ba409462",
"flow_id": "d14c70ad-6c59-4092-b51f-b75f6edf04e3",
"timerange_to_delete": "[1537349337:0_1537349347:21333333)",
"timerange_remaining": "[1537349339:0_1537349347:21333333)",
"delete_flow": true,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:40:09.339393+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "started"
}
"id": "9f0187c1-419c-44d2-8269-e869ba409462",
"flow_id": "d14c70ad-6c59-4092-b51f-b75f6edf04e3",
"timerange_to_delete": "[1537349337:0_1537349347:21333333)",
"timerange_remaining": "[1537349339:0_1537349347:21333333)",
"delete_flow": true,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:40:09.339393+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "started"
}
100 changes: 50 additions & 50 deletions api/examples/deletion-requests-get-200.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
[
{
"id": "9f0187c1-419c-44d2-8269-e869ba409462",
"flow_id": "d14c70ad-6c59-4092-b51f-b75f6edf04e3",
"timerange_to_delete": "[1537349337:0_1537349347:21333333)",
"timerange_remaining": "[1537349339:0_1537349347:21333333)",
"delete_flow": true,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:40:09.339393+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "started"
},
{
"id": "58b3793e-c9ad-4a7f-b680-e823685bb52d",
"flow_id": "58b3793e-c9ad-4a7f-b680-e823685bb52d",
"timerange_to_delete": "[0:0_1000:0)",
"timerange_remaining": "[900:0_1000:0)",
"delete_flow": false,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:40:09.339393+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "started"
},
{
"id": "3f04ae16-8b78-4426-9ccf-85ddaf908937",
"flow_id": "f43619e9-6333-438d-95b3-1e89f426d920",
"timerange_to_delete": "[0:0_1000:0)",
"timerange_remaining": "[900:0_1000:0)",
"delete_flow": false,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:18:52.426792+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "error",
"error": {
"type": "TAMSError",
"summary": "Flow delete failed because ...",
"traceback": [
"Exception: The flow segment could not be deleted",
"The above exception was the direct cause of the following exception:",
"",
"",
"Traceback (most recent call last):",
" <traceback...>",
"TAMSError: Unable to continue"
],
"time": "2018-12-10T15:18:52.426792+00:00"
}
{
"id": "9f0187c1-419c-44d2-8269-e869ba409462",
"flow_id": "d14c70ad-6c59-4092-b51f-b75f6edf04e3",
"timerange_to_delete": "[1537349337:0_1537349347:21333333)",
"timerange_remaining": "[1537349339:0_1537349347:21333333)",
"delete_flow": true,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:40:09.339393+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "started"
},
{
"id": "58b3793e-c9ad-4a7f-b680-e823685bb52d",
"flow_id": "58b3793e-c9ad-4a7f-b680-e823685bb52d",
"timerange_to_delete": "[0:0_1000:0)",
"timerange_remaining": "[900:0_1000:0)",
"delete_flow": false,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:40:09.339393+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "started"
},
{
"id": "3f04ae16-8b78-4426-9ccf-85ddaf908937",
"flow_id": "f43619e9-6333-438d-95b3-1e89f426d920",
"timerange_to_delete": "[0:0_1000:0)",
"timerange_remaining": "[900:0_1000:0)",
"delete_flow": false,
"created": "2018-12-10T15:40:08.339376+00:00",
"updated": "2018-12-10T15:18:52.426792+00:00",
"expiry": "2018-12-11T15:40:09.339393+00:00",
"created_by": "tams-dev",
"status": "error",
"error": {
"type": "TAMSError",
"summary": "Flow delete failed because ...",
"traceback": [
"Exception: The flow segment could not be deleted",
"The above exception was the direct cause of the following exception:",
"",
"",
"Traceback (most recent call last):",
" <traceback...>",
"TAMSError: Unable to continue"
],
"time": "2018-12-10T15:18:52.426792+00:00"
}
]
}
]
24 changes: 12 additions & 12 deletions api/examples/flow-collection-get-200.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"id": "4f79cfd1-c057-47f4-8e4d-1b126ca7bf34",
"role": "video"
},
{
"id": "6101df05-06bb-41b8-8af4-cf7cd33df209",
"role": "audio"
},
{
"id": "e85efab4-993b-4ad6-9af3-4cd8d0d38860",
"role": "subtitles"
}
{
"id": "4f79cfd1-c057-47f4-8e4d-1b126ca7bf34",
"role": "video"
},
{
"id": "6101df05-06bb-41b8-8af4-cf7cd33df209",
"role": "audio"
},
{
"id": "e85efab4-993b-4ad6-9af3-4cd8d0d38860",
"role": "subtitles"
}
]
24 changes: 12 additions & 12 deletions api/examples/flow-collection-put.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"id": "4f79cfd1-c057-47f4-8e4d-1b126ca7bf34",
"role": "video"
},
{
"id": "6101df05-06bb-41b8-8af4-cf7cd33df209",
"role": "audio"
},
{
"id": "e85efab4-993b-4ad6-9af3-4cd8d0d38860",
"role": "subtitles"
}
{
"id": "4f79cfd1-c057-47f4-8e4d-1b126ca7bf34",
"role": "video"
},
{
"id": "6101df05-06bb-41b8-8af4-cf7cd33df209",
"role": "audio"
},
{
"id": "e85efab4-993b-4ad6-9af3-4cd8d0d38860",
"role": "subtitles"
}
]
58 changes: 29 additions & 29 deletions api/examples/flow-get-200-audio-aac-multi.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"id": "94996f2e-0cb5-43d3-ab6c-db5a9cf667aa",
"source_id": "1f0bdb2d-e8f3-4d2d-9b27-b71ff0728ed1",
"generation": 1,
"created": "2018-03-06T09:10:22Z",
"metadata_updated": "2018-03-06T09:12:22Z",
"segments_updated": "2018-03-06T11:14:32Z",
"description": "audio capture web",
"label": "capture_1",
"format": "urn:x-nmos:format:audio",
"created_by": "tams-dev",
"updated_by": "tams-dev",
"tags": {
"quality": "web"
},
"codec": "audio/aac",
"avg_bit_rate": 128,
"essence_parameters": {
"sample_rate": 48000,
"channels": 2,
"bit_depth": 24,
"codec_parameters": {
"coded_frame_size": 1024,
"mp4_oti": 2
}
},
"collected_by": [
"8159b781-6033-42e8-b3a1-8a879af5e1aa"
]
}
"id": "94996f2e-0cb5-43d3-ab6c-db5a9cf667aa",
"source_id": "1f0bdb2d-e8f3-4d2d-9b27-b71ff0728ed1",
"generation": 1,
"created": "2018-03-06T09:10:22Z",
"metadata_updated": "2018-03-06T09:12:22Z",
"segments_updated": "2018-03-06T11:14:32Z",
"description": "audio capture web",
"label": "capture_1",
"format": "urn:x-nmos:format:audio",
"created_by": "tams-dev",
"updated_by": "tams-dev",
"tags": {
"quality": "web"
},
"codec": "audio/aac",
"avg_bit_rate": 128,
"essence_parameters": {
"sample_rate": 48000,
"channels": 2,
"bit_depth": 24,
"codec_parameters": {
"coded_frame_size": 1024,
"mp4_oti": 2
}
},
"collected_by": [
"8159b781-6033-42e8-b3a1-8a879af5e1aa"
]
}
60 changes: 30 additions & 30 deletions api/examples/flow-get-200-audio-aac.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"id": "6101df05-06bb-41b8-8af4-cf7cd33df209",
"source_id": "41d7f7eb-c48d-4513-9b37-17b418d26d7f",
"generation": 1,
"created": "2018-03-06T09:10:22Z",
"metadata_updated": "2018-03-06T09:12:22Z",
"segments_updated": "2018-03-06T11:14:32Z",
"description": "audio capture web",
"label": "capture_1",
"format": "urn:x-nmos:format:audio",
"created_by": "tams-dev",
"updated_by": "tams-dev",
"tags": {
"input_quality": "web"
},
"codec": "audio/aac",
"container": "video/mp2t",
"avg_bit_rate": 128,
"essence_parameters": {
"sample_rate": 48000,
"channels": 2,
"bit_depth": 24,
"codec_parameters": {
"coded_frame_size": 1024,
"mp4_oti": 2
}
},
"collected_by": [
"e85efab4-993b-4ad6-9af3-4cd8d0d38860"
]
}
"id": "6101df05-06bb-41b8-8af4-cf7cd33df209",
"source_id": "41d7f7eb-c48d-4513-9b37-17b418d26d7f",
"generation": 1,
"created": "2018-03-06T09:10:22Z",
"metadata_updated": "2018-03-06T09:12:22Z",
"segments_updated": "2018-03-06T11:14:32Z",
"description": "audio capture web",
"label": "capture_1",
"format": "urn:x-nmos:format:audio",
"created_by": "tams-dev",
"updated_by": "tams-dev",
"tags": {
"input_quality": "web"
},
"codec": "audio/aac",
"container": "video/mp2t",
"avg_bit_rate": 128,
"essence_parameters": {
"sample_rate": 48000,
"channels": 2,
"bit_depth": 24,
"codec_parameters": {
"coded_frame_size": 1024,
"mp4_oti": 2
}
},
"collected_by": [
"e85efab4-993b-4ad6-9af3-4cd8d0d38860"
]
}
Loading
Loading