From 8ae4639f23d7164f5d50a93769f15a159e449426 Mon Sep 17 00:00:00 2001 From: QFer Date: Thu, 15 Oct 2020 12:02:53 +0200 Subject: [PATCH 1/5] [Issue-657] appending-path-to-server-url --- apistar/schemas/openapi.py | 5 ++--- tests/schemas/test_openapi.py | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apistar/schemas/openapi.py b/apistar/schemas/openapi.py index b8742699..c2c31640 100644 --- a/apistar/schemas/openapi.py +++ b/apistar/schemas/openapi.py @@ -1,7 +1,6 @@ import re -from urllib.parse import urljoin - import typesystem + from apistar.document import Document, Field, Link, Section from apistar.schemas.jsonschema import JSON_SCHEMA @@ -462,7 +461,7 @@ def get_link( return Link( name=name, - url=urljoin(base_url, path), + url=(base_url or "") + path, method=operation, title=title, description=description, diff --git a/tests/schemas/test_openapi.py b/tests/schemas/test_openapi.py index 3b23cafe..60fd9f5c 100644 --- a/tests/schemas/test_openapi.py +++ b/tests/schemas/test_openapi.py @@ -1,5 +1,4 @@ import os - import pytest import apistar @@ -21,4 +20,7 @@ def test_openapi(filename): path, extension = os.path.splitext(filename) encoding = {".json": "json", ".yaml": "yaml"}[extension] - apistar.validate(content, format="openapi", encoding=encoding) + document = apistar.validate(content, format="openapi", encoding=encoding) + if document.url is not None: + for link_info in document.walk_links(): + assert document.url in link_info.link.url From d7e062bd8abc1cc6ecd60a6c058c22c7edbe1d83 Mon Sep 17 00:00:00 2001 From: Angelos Bousias Date: Fri, 17 Sep 2021 12:24:39 +0200 Subject: [PATCH 2/5] Pin typesystem for this version of apistar --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cf3a4712..1829fc9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ click jinja2 requests pyyaml -typesystem>=0.2.0 +typesystem>=0.2.0,<0.3 # Testing requirements black From 647839484b2f159d9bd68b9ec8bf10f48c20eb68 Mon Sep 17 00:00:00 2001 From: Angelos Bousias Date: Fri, 17 Sep 2021 12:39:41 +0200 Subject: [PATCH 3/5] Try with this --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1829fc9d..4df5a88c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ click jinja2 requests pyyaml -typesystem>=0.2.0,<0.3 +typesystem=0.2.4 # Testing requirements black From 84ff847941a4eb721010b124be7aba4ad42d1584 Mon Sep 17 00:00:00 2001 From: Angelos Bousias Date: Fri, 17 Sep 2021 13:16:21 +0200 Subject: [PATCH 4/5] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4df5a88c..72e1f1cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ click jinja2 requests pyyaml -typesystem=0.2.4 +typesystem<=0.3 # Testing requirements black From 61535afa5ff1d250da9a12a07b89d5be43511837 Mon Sep 17 00:00:00 2001 From: Angelos Bousias Date: Fri, 17 Sep 2021 13:17:52 +0200 Subject: [PATCH 5/5] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 72e1f1cf..88e4409f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ click jinja2 requests pyyaml -typesystem<=0.3 +typesystem==0.2.4 # Testing requirements black