Skip to content

Commit

Permalink
Fixed broken links in documentation.
Browse files Browse the repository at this point in the history
Also updated links to canonical locations to reduce redirects.

These were discovered using `make linkcheck`.

I did something similar a while back for Django:

    django/django#14325
  • Loading branch information
ngnpope committed Apr 21, 2022
1 parent f11081a commit d3e8c55
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.rst
Expand Up @@ -788,7 +788,7 @@ Breaking changes:
- Parse path parameter type hints from url. closes `#34 <https://github.com/tfranzel/drf-spectacular/issues/34>`_
- Consolidate duplicate warnings/add error `#28 <https://github.com/tfranzel/drf-spectacular/issues/28>`_
- Prevent warning for DRF format suffix param
- Improve ACCEPT header handling `#42 <https://github.com/tfranzel/drf-spectacular/issues/42>`_
- Improve ACCEPT header handling `#42 <https://github.com/tfranzel/drf-spectacular/issues/42>`_

Breaking changes:

Expand Down Expand Up @@ -868,7 +868,7 @@ Breaking changes:
- Warn on duplicate serializer names.
- Added explicit exclude flag for operation.
- Bugfix: PrimaryKeyRelatedField(read_only=True) failing to find type.
- Change operation sorting to alphanumeric with option (`#6 <https://github.com/tfranzel/drf-spectacular/issues/6>`_)
- Change operation sorting to alphanumeric with option (`#6 <https://github.com/tfranzel/drf-spectacular/issues/6>`_)
- Robustify serializer field support for ``@extend_schema_field``.
- Enable field serializers support. [p.g.alekseev]
- Adding custom tags support [p.g.alekseev]
Expand Down
14 changes: 7 additions & 7 deletions README.rst
Expand Up @@ -37,7 +37,7 @@ Features
- Callback operations (experimental)
- Included support for:
- `django-polymorphic <https://github.com/django-polymorphic/django-polymorphic>`_ / `django-rest-polymorphic <https://github.com/apirobot/django-rest-polymorphic>`_
- `SimpleJWT <https://github.com/SimpleJWT/django-rest-framework-simplejwt>`_
- `SimpleJWT <https://github.com/jazzband/djangorestframework-simplejwt>`_
- `DjangoOAuthToolkit <https://github.com/jazzband/django-oauth-toolkit>`_
- `djangorestframework-jwt <https://github.com/jpadilla/django-rest-framework-jwt>`_ (tested fork `drf-jwt <https://github.com/Styria-Digital/django-rest-framework-jwt>`_)
- `dj-rest-auth <https://github.com/iMerica/dj-rest-auth>`_ (maintained fork of `django-rest-auth <https://github.com/Tivix/django-rest-auth>`_)
Expand All @@ -48,7 +48,7 @@ Features
- `djangorestframework-dataclasses <https://github.com/oxan/djangorestframework-dataclasses>`_


For more information visit the `documentation <https://drf-spectacular.readthedocs.io>`_.
For more information visit the `documentation <https://drf-spectacular.readthedocs.io/>`_.

License
-------
Expand Down Expand Up @@ -288,16 +288,16 @@ globally, and then simply run:
$ tox
.. _Django REST framework: https://www.django-rest-framework.org/
.. _OpenAPI 3.0: https://github.com/OAI/OpenAPI-Specification
.. _tox: http://tox.readthedocs.org/en/latest/
.. _OpenAPI 3.0: https://spec.openapis.org/oas/v3.0.3
.. _tox: https://tox.wiki/
.. _drf-spectacular-sidecar: https://github.com/tfranzel/drf-spectacular-sidecar

.. |build-status| image:: https://github.com/tfranzel/drf-spectacular/actions/workflows/ci.yml/badge.svg
:target: https://github.com/tfranzel/drf-spectacular/actions/workflows/ci.yml
.. |pypi-version| image:: https://img.shields.io/pypi/v/drf-spectacular.svg
:target: https://pypi.python.org/pypi/drf-spectacular
.. |codecov| image:: https://codecov.io/gh/tfranzel/drf-spectacular/branch/master/graph/badge.svg
:target: https://codecov.io/gh/tfranzel/drf-spectacular
:target: https://pypi.org/project/drf-spectacular/
.. |codecov| image:: https://app.codecov.io/gh/tfranzel/drf-spectacular/branch/master/graph/badge.svg
:target: https://app.codecov.io/gh/tfranzel/drf-spectacular
.. |docs| image:: https://readthedocs.org/projects/drf-spectacular/badge/
:target: https://drf-spectacular.readthedocs.io/
.. |pypi-dl| image:: https://img.shields.io/pypi/dm/drf-spectacular
Expand Down
7 changes: 5 additions & 2 deletions docs/client_generation.rst
Expand Up @@ -59,8 +59,11 @@ field. Even though it is the correct way (according to the specification), it sa
Setting ``'ENUM_ADD_EXPLICIT_BLANK_NULL_CHOICE': False`` will create a less accurate schema that tends to offend
fewer generator targets.

For more information please refer to the `official documentation <https://swagger.io/docs/specification/data-models/enums/>`_ and
more specifically the `specification proposal <https://github.com/OAI/OpenAPI-Specification/blob/master/proposals/003_Clarify-Nullable.md#if-a-schema-specifies-nullable-true-and-enum-1-2-3-does-that-schema-allow-null-values-see-1900>`_.
For more information please refer to the `official documentation`__ and more specifically the `specification
proposal`__.

__ https://swagger.io/docs/specification/data-models/enums/
__ https://github.com/OAI/OpenAPI-Specification/blob/main/proposals/2019-10-31-Clarify-Nullable.md#user-content-if-a-schema-specifies-nullable-true-and-enum-1-2-3-does-that-schema-allow-null-values-see-1900

Relevant settings:

Expand Down
14 changes: 14 additions & 0 deletions docs/conf.py
Expand Up @@ -48,6 +48,20 @@

default_role = 'default-role-error'

linkcheck_allowed_redirects = {
r"^https://tox\.wiki/$": r"https://tox\.wiki/en/latest/$",
r"^https://drf-spectacular\.readthedocs\.io/$": r"https://drf-spectacular\.readthedocs\.io/en/latest/$",
r"^https://docs\.djangoproject\.com/en/stable/": r"^https://docs\.djangoproject\.com/en/\d+\.\d+/",
r"^https://github\.com/tfranzel/drf-spectacular/issues/\d+": "https://github\.com/tfranzel/drf-spectacular/pull/\d+",
}

linkcheck_ignore = [
# Special-use addresses and domain names. (RFC 6761/6890)
r"^https?://(?:127\.0\.0\.1|\[::1\])(?::\d+)?/",
r"^https?://(?:[^/\.]+\.)*example\.(?:com|net|org)(?::\d+)?/",
r"^https?://(?:[^/\.]+\.)*(?:example|invalid|localhost|test)(?::\d+)?/",
]

nitpicky = True

nitpick_ignore_regex = [
Expand Down
8 changes: 4 additions & 4 deletions drf_spectacular/extensions.py
Expand Up @@ -23,7 +23,7 @@ class OpenApiAuthenticationExtension(OpenApiGeneratorExtension['OpenApiAuthentic
set a higher matching priority by setting the class attribute ``priority = 1`` or higher.
``get_security_definition()`` is expected to return a valid `OpenAPI security scheme object
<https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object>`_
<https://spec.openapis.org/oas/v3.0.3#securitySchemeObject>`_
"""
_registry: List['OpenApiAuthenticationExtension'] = []

Expand Down Expand Up @@ -51,7 +51,7 @@ class OpenApiSerializerExtension(OpenApiGeneratorExtension['OpenApiSerializerExt
can be accessed via ``self.target``.
``map_serializer()`` is expected to return a valid `OpenAPI schema object
<https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object>`_.
<https://spec.openapis.org/oas/v3.0.3#schemaObject>`_.
"""
_registry: List['OpenApiSerializerExtension'] = []

Expand All @@ -74,7 +74,7 @@ class OpenApiSerializerFieldExtension(OpenApiGeneratorExtension['OpenApiSerializ
warnings, in which case manual construction is advisable.
``map_serializer_field()`` is expected to return a valid `OpenAPI schema object
<https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object>`_.
<https://spec.openapis.org/oas/v3.0.3#schemaObject>`_.
"""
_registry: List['OpenApiSerializerFieldExtension'] = []

Expand Down Expand Up @@ -119,7 +119,7 @@ class OpenApiFilterExtension(OpenApiGeneratorExtension['OpenApiFilterExtension']
``get_schema_operation_parameters()`` is expected to return either an empty list or a list
of valid raw `OpenAPI parameter objects
<https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject>`_.
<https://spec.openapis.org/oas/v3.0.3#parameterObject>`_.
Using ``drf_spectacular.plumbing.build_parameter_type`` is recommended to generate
the appropriate raw dict objects.
"""
Expand Down
2 changes: 1 addition & 1 deletion drf_spectacular/plumbing.py
Expand Up @@ -1058,7 +1058,7 @@ def sanitize_result_object(result):


def sanitize_specification_extensions(extensions):
# https://spec.openapis.org/oas/v3.0.3#specification-extensions
# https://spec.openapis.org/oas/v3.0.3#specificationExtensions
output = {}
for key, value in extensions.items():
if not re.match(r'^x-', key):
Expand Down
4 changes: 2 additions & 2 deletions drf_spectacular/settings.py
Expand Up @@ -158,7 +158,7 @@
'ENABLE_DJANGO_DEPLOY_CHECK': True,

# General schema metadata. Refer to spec for valid inputs
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#openapi-object
# https://spec.openapis.org/oas/v3.0.3#openapi-object
'TITLE': '',
'DESCRIPTION': '',
'TOS': None,
Expand Down Expand Up @@ -188,7 +188,7 @@
'EXTENSIONS_ROOT': {},

# Oauth2 related settings. used for example by django-oauth2-toolkit.
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#oauth-flows-object
# https://spec.openapis.org/oas/v3.0.3#oauthFlowsObject
'OAUTH2_FLOWS': [],
'OAUTH2_AUTHORIZATION_URL': None,
'OAUTH2_TOKEN_URL': None,
Expand Down

0 comments on commit d3e8c55

Please sign in to comment.