From bdf7e8a4ae40f57a3cdf8ea96b2ae041128c7908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20V=C3=AEjdea?= Date: Fri, 15 Dec 2017 19:25:25 +0100 Subject: [PATCH] Prepare release 1.0.3 --- docs/changelog.rst | 18 ++++++++++++++++++ docs/conf.py | 41 +++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + src/drf_yasg/openapi.py | 1 - 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 docs/changelog.rst diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..42f537f --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,18 @@ +######### +Changelog +######### + + +********* +**1.0.3** +********* + +- **FIX:** fixed bug that caused schema views returned from cache to fail (:issue:`14`) +- **FIX:** disabled automatic generation of response schemas for form operations to avoid confusing errors caused by + attempting to shove file parameters into Schema objects + +********* +**1.0.2** +********* + +- First published version diff --git a/docs/conf.py b/docs/conf.py index 6a38a80..ccabf80 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -7,6 +7,9 @@ import os import sys import sphinx_rtd_theme +from docutils import nodes, utils +from docutils.parsers.rst import roles +from docutils.parsers.rst.roles import set_classes from pkg_resources import get_distribution # -- General configuration ------------------------------------------------ @@ -204,3 +207,41 @@ import drf_yasg.views # noqa: E402 # instantiate a SchemaView in the views module to make it available to autodoc drf_yasg.views.SchemaView = drf_yasg.views.get_schema_view(None) + +ghiss_uri = "https://github.com/axnsan12/drf-yasg/issues/%d" +ghpr_uri = "https://github.com/axnsan12/drf-yasg/pull/%d" + + +def role_github_pull_request_or_issue(name, rawtext, text, lineno, inliner, options=None, content=None): + options = options or {} + content = content or [] + try: + ghid = int(text) + if ghid <= 0: + raise ValueError + except ValueError: + msg = inliner.reporter.error( + 'GitHub pull request or issue number must be a number greater than or equal to 1; ' + '"%s" is invalid.' % text, line=lineno + ) + prb = inliner.problematic(rawtext, rawtext, msg) + return [prb], [msg] + # Base URL mainly used by inliner.rfc_reference, so this is correct: + + if name == 'pr': + ref = ghpr_uri + elif name == 'issue': + ref = ghiss_uri + else: + msg = inliner.reporter.error('unknown tag name for GitHub reference - "%s"' % name, line=lineno) + prb = inliner.problematic(rawtext, rawtext, msg) + return [prb], [msg] + + ref = ref % ghid + set_classes(options) + node = nodes.reference(rawtext, '#' + utils.unescape(text), refuri=ref, **options) + return [node], [] + + +roles.register_local_role('pr', role_github_pull_request_or_issue) +roles.register_local_role('issue', role_github_pull_request_or_issue) diff --git a/docs/index.rst b/docs/index.rst index 2f999f3..6fd9874 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,6 +17,7 @@ drf-yasg settings.rst contributing.rst license.rst + changelog.rst Source code documentation ========================= diff --git a/src/drf_yasg/openapi.py b/src/drf_yasg/openapi.py index 0e8e662..cd42ebe 100644 --- a/src/drf_yasg/openapi.py +++ b/src/drf_yasg/openapi.py @@ -1,4 +1,3 @@ -import copy from collections import OrderedDict from coreapi.compat import urlparse