From 767ff3863dc2a06fcab067d27735349420f227aa Mon Sep 17 00:00:00 2001 From: Matteo Romanello Date: Mon, 13 Apr 2026 18:10:30 +0200 Subject: [PATCH 1/3] update everywhere the URL of the JSON-LD context (see issue #16) and `dtsVersion` to 1.0 --- dapytains/app/app.py | 15 +++++++++------ tests/test_app.py | 14 ++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/dapytains/app/app.py b/dapytains/app/app.py index c03b4d8..a47b7de 100644 --- a/dapytains/app/app.py +++ b/dapytains/app/app.py @@ -21,6 +21,9 @@ dotenv_flow(os.getenv("SERVER_ENV", "prod")) +CONTEXT_URL = "https://dtsapi.org/context/v1.0.json" +DTS_VERSION = "1.0" + def inject_json(collection: Collection, templates) -> Dict: if collection.resource: @@ -75,8 +78,8 @@ def collection_view( return msg_4xx(f"nav parameter has a wrong value {nav}", code=400) return Response(json.dumps({ - "@context": "https://distributed-text-services.github.io/specifications/context/1-alpha1.json", - "dtsVersion": "1-alpha", + "@context": CONTEXT_URL, + "dtsVersion": DTS_VERSION, **out, "member": [ member.json(inject=inject_json(member, templates=templates)) @@ -153,8 +156,8 @@ def navigation_view(resource, ref, start, end, tree, down, templates: Dict[str, # Start the response out = { - "@context": "https://distributed-text-services.github.io/specifications/context/1-alpha1.json", - "dtsVersion": "1-alpha", + "@context": CONTEXT_URL, + "dtsVersion": DTS_VERSION, "@type": "Navigation", "@id": templates["navigation"].expand({ "ref": ref, "down": down, "start": start, "end": end, "tree": tree @@ -220,8 +223,8 @@ def index_route(): return Response( json.dumps({ - "@context": "https://distributed-text-services.github.io/specifications/context/1-alpha1.json", - "dtsVersion": "1-alpha", + "@context": CONTEXT_URL, + "dtsVersion": DTS_VERSION, "@id": f"{request.url_root}", "@type": "EntryPoint", "collection": collection_template.uri, diff --git a/tests/test_app.py b/tests/test_app.py index 01a2613..6a6f155 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -9,6 +9,8 @@ basedir = os.path.abspath(os.path.dirname(__file__)) BASE_URI = "http://localhost" +CONTEXT_URL = "https://dtsapi.org/context/v1.0.json" +DTS_VERSION = "1.0" @pytest.fixture @@ -51,10 +53,10 @@ def test_index(client): response = client.get('/') assert response.status_code == 200 assert response.get_json() == { - '@context': 'https://distributed-text-services.github.io/specifications/context/1-alpha1.json', + '@context': CONTEXT_URL, '@id': 'http://localhost/', '@type': 'EntryPoint', - 'dtsVersion': '1-alpha', + 'dtsVersion': DTS_VERSION, 'collection': 'http://localhost/collection/{?id}{&nav}', 'document': 'http://localhost/document/{?resource}{&ref,start,end,tree}', 'navigation': 'http://localhost/navigation/{?resource}{&ref,start,end,tree,down}', @@ -67,11 +69,11 @@ def test_collection(client): response = client.get(template.expand({})) j = response.get_json() assert { - '@context': 'https://distributed-text-services.github.io/specifications/context/1-alpha1.json', + '@context': CONTEXT_URL, '@id': 'https://foo.bar/default', '@type': 'Collection', 'collection': 'http://localhost/collection/?id=https%3A%2F%2Ffoo.bar%2Fdefault{&nav}', - 'dtsVersion': '1-alpha', + 'dtsVersion': DTS_VERSION, 'dublinCore': {'abstract': ['This is a perfect example of an absract.', {'lang': 'fr', 'value': 'Et je peux traduire en français'}]}, @@ -133,11 +135,11 @@ def test_collection(client): collection = uritemplate.URITemplate(j["member"][0]["collection"]).expand( {"id": j["member"][0]["@id"]}) response = client.get(collection.replace(BASE_URI, "")) - assert {'@context': 'https://distributed-text-services.github.io/specifications/context/1-alpha1.json', + assert {'@context': CONTEXT_URL, '@id': 'https://example.org/collection1', '@type': 'Collection', 'collection': 'http://localhost/collection/?id=https%3A%2F%2Fexample.org%2Fcollection1{&nav}', - 'dtsVersion': '1-alpha', + 'dtsVersion': DTS_VERSION, 'dublinCore': {'creator': ['John Doe'], 'date': ['2023-08-24'], 'subject': ['History']}, From 0f36865099676a363d11f3a8c4bb600fb117deb9 Mon Sep 17 00:00:00 2001 From: Matteo Romanello Date: Mon, 13 Apr 2026 18:11:42 +0200 Subject: [PATCH 2/3] fixed a typo in the README (dapitains -> dapytains) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e214383..8f0f4e0 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This library will: ## WebApp -You can try the webapp using `python -m dapitains.app.app`. It uses test files at the moment. +You can try the webapp using `python -m dapytains.app.app`. It uses test files at the moment. ## Guidelines From 73989818479fed2688099e9262b39df0b335eea3 Mon Sep 17 00:00:00 2001 From: Matteo Romanello Date: Mon, 13 Apr 2026 18:18:09 +0200 Subject: [PATCH 3/3] update validator's version to 0.2.3 in GitHub action configuration --- .github/workflows/dts-validator.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dts-validator.yml b/.github/workflows/dts-validator.yml index 87b23ac..dfde4a1 100644 --- a/.github/workflows/dts-validator.yml +++ b/.github/workflows/dts-validator.yml @@ -27,8 +27,8 @@ jobs: - uses: actions/checkout@v4 name: Clone DTS-Validator with: - repository: 'mromanello/DTS-validator' - ref: 'v0.2.0' + repository: 'distributed-text-services/validator' + ref: 'v0.2.3' path: "dts-validator" # Flask Server