Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

[Issue-657] Appending path to server url #680

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
5 changes: 2 additions & 3 deletions apistar/schemas/openapi.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ click
jinja2
requests
pyyaml
typesystem>=0.2.0
typesystem==0.2.4

# Testing requirements
black
Expand Down
6 changes: 4 additions & 2 deletions tests/schemas/test_openapi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os

import pytest

import apistar
Expand All @@ -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