Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.21.7 ug #1

Open
wants to merge 101 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
02cc192
Add sample code to handle Base64 fields in drf-extra-fields project
WasinTh Aug 25, 2019
b0f1906
Fix format for .rst
WasinTh Aug 25, 2019
67f5489
Update answer to the easier version as suggested in https://github.co…
WasinTh Aug 14, 2020
5b88e65
update readme.rst
sumit4613 Dec 12, 2020
426fb5d
url from DEFAULT_API_URL now works
CoreJa Dec 25, 2020
d2a2783
Check for allow_null attribute
krectra Jan 6, 2021
ecf1699
Merge pull request #1 from capslent/serpy_allow_null
krectra Jan 6, 2021
00f8838
Add utf-8 support for generated formats
Jan 14, 2021
364732a
Added `many` support to example code.
cbek Jan 22, 2021
cbdb713
serialize pytz object as a string
MilanPecov May 11, 2021
11fdb02
simplify if condition
krectra May 24, 2021
571cd00
Merge branch 'master' into add-support-for-timezone-field
JoelLefkowitz Sep 22, 2021
468d0b9
Merge branch 'master' into patch-1
JoelLefkowitz Sep 22, 2021
e6d0528
Merge branch 'master' into utf8-support
JoelLefkowitz Sep 22, 2021
be1f084
handle errors rendering with TemplateHTMLRenderer
terencehonles Sep 23, 2021
049c2ed
Merge branch 'master' into master
axnsan12 Dec 12, 2021
6670052
Allow specifying response as a reference
vmax Nov 28, 2021
e6c1aad
[readme] Fix missing re_path import
damien-ramelet Feb 15, 2022
0c14a4f
fix map source mapping
PetrDlouhy Feb 22, 2022
7230713
Merge branch 'master' into master
krectra Mar 6, 2022
ab7f37f
Remove universal wheel, python 2 is unsupported
gopackgo90 Mar 11, 2022
fc4d6a1
Merge pull request #778 from PetrDlouhy/master
JoelLefkowitz Jul 14, 2022
3f01252
Merge pull request #773 from damien-devpy/missing_import_readme
JoelLefkowitz Jul 14, 2022
55d2805
Inline allow_unicode parameter
JoelLefkowitz Jul 14, 2022
113be08
Merge pull request #692 from ProstoMaxim/utf8-support
JoelLefkowitz Jul 14, 2022
850ccf5
Update changelog
JoelLefkowitz Jul 14, 2022
8bc55e8
Update changelog typos
JoelLefkowitz Jul 14, 2022
78720c7
Merge pull request #782 from gopackgo90/patch-1
JoelLefkowitz Jul 15, 2022
f5f9b2a
Add cspell
JoelLefkowitz Jul 15, 2022
58d0cdf
Fix old spelling errors
JoelLefkowitz Jul 15, 2022
a577536
Add ref_name to UserSerializer after removing suffix typo
JoelLefkowitz Jul 15, 2022
1b03e72
Merge pull request #796 from axnsan12/cspell
JoelLefkowitz Jul 15, 2022
6745ddb
Merge pull request #757 from oppgjorskontoret/allow-inserting-arbitra…
JoelLefkowitz Jul 17, 2022
60ae05c
Merge branch '1.21.x' into pr/742
JoelLefkowitz Jul 17, 2022
4289361
Merge branch '1.21.x' into pr/717
JoelLefkowitz Jul 17, 2022
eebb245
Merge branch '1.21.x' into pr/695
JoelLefkowitz Jul 17, 2022
fe08c76
Merge branch '1.21.x' into pr/688
JoelLefkowitz Jul 17, 2022
4e6564a
Merge branch '1.21.x' into pr/682
JoelLefkowitz Jul 17, 2022
a088d32
Merge branch '1.21.x' into pr/678
JoelLefkowitz Jul 17, 2022
ba54faa
Merge branch '1.21.x' into pr/445
JoelLefkowitz Jul 17, 2022
1662fc8
Set permission classes to a tuple
JoelLefkowitz Jul 17, 2022
ea5c3b6
Merge pull request #695 from cbek/patch-1
JoelLefkowitz Jul 17, 2022
5774190
Merge pull request #445 from WasinTh/drf-extra-fields-base64-integration
JoelLefkowitz Jul 17, 2022
d3b14ab
Merge pull request #678 from sumit4613/patch-1
JoelLefkowitz Jul 17, 2022
124f2cd
Update chagnelog
JoelLefkowitz Jul 17, 2022
0ec7f89
Add prepublish twine check
JoelLefkowitz Jul 18, 2022
deb3994
Fix action version syntax
JoelLefkowitz Jul 18, 2022
8b76535
Fix indentation in README.rst code blocks
JoelLefkowitz Jul 18, 2022
3972472
Add twine to publish dependencies
JoelLefkowitz Jul 18, 2022
fe53426
Specify toxenv explicitly
JoelLefkowitz Jul 18, 2022
822f66d
Specify all tox targets
JoelLefkowitz Jul 18, 2022
d7314b6
Add py prefix to toxenvs
JoelLefkowitz Jul 18, 2022
a000102
Update changelog
JoelLefkowitz Jul 18, 2022
f4bf7ba
Merge pull request #797 from axnsan12/prepublish
JoelLefkowitz Jul 18, 2022
f87dbd5
Merge pull request #742 from terencehonles/handle-errors-rendering-wi…
JoelLefkowitz Jul 18, 2022
13f0af2
Merge pull request #717 from MilanPecov/add-support-for-timezone-field
JoelLefkowitz Jul 18, 2022
cb03608
Merge pull request #688 from krectra/master
JoelLefkowitz Jul 18, 2022
0e09cbe
Merge pull request #682 from CoreJa/master
JoelLefkowitz Jul 18, 2022
00b042b
Update changelog
JoelLefkowitz Jul 18, 2022
7adddf7
Declare Django 3.2 support in README, classifiers
DavidCain Aug 3, 2022
611594d
Fix `pip install` command for contributors on zsh
DavidCain Aug 3, 2022
44fed4b
Merge pull request #803 from DavidCain/dcain-django32
JoelLefkowitz Aug 9, 2022
d73cffc
Merge pull request #802 from DavidCain/dcain-contributing
JoelLefkowitz Aug 20, 2022
5420475
Dont use NullBooleanField if drf version >= 3.14.0
JoelLefkowitz Sep 24, 2022
2646dfa
Swap back BooleanField and NullBooleanField
JoelLefkowitz Sep 24, 2022
a58f098
Merge pull request #814 from axnsan12/fix/drf-3.14.0
JoelLefkowitz Sep 26, 2022
0cdc4bd
Update changelog
JoelLefkowitz Sep 26, 2022
bf9b217
Update README to use path instead of re_path in example
amir-bio Oct 4, 2022
5aa412d
Run tests with latest dependencies
nikosmichas Oct 15, 2022
d37d792
Add python 3.10 in GH actions matrix
nikosmichas Oct 15, 2022
3dbc697
Fix RecursiveField
iorlandini Oct 25, 2022
fa3ebf5
Merge pull request #816 from amir-bio/update-readme-to-use-path
JoelLefkowitz Feb 8, 2023
c2b3555
Merge branch '1.21.x' into run-tests-with-new-dj-drf
JoelLefkowitz Feb 8, 2023
2e24395
Merge pull request #822 from iorlandini/master
JoelLefkowitz Feb 8, 2023
4ead159
Change github actions runner from ubuntu-latest to ubuntu-20.04
JoelLefkowitz Feb 8, 2023
d071aa0
Change github actions runner from ubuntu-latest to ubuntu-20.04
JoelLefkowitz Feb 8, 2023
4aa2c0a
Remove python 3.6 tests since swagger-spec-validator no longer suppor…
JoelLefkowitz Feb 8, 2023
158bd10
Merge branch '1.21.x' into run-tests-with-new-dj-drf
JoelLefkowitz Feb 8, 2023
860b8ff
Use a string literal for python versions such as "3.10"
JoelLefkowitz Feb 8, 2023
19e5ab2
Merge pull request #818 from nikosmichas/run-tests-with-new-dj-drf
JoelLefkowitz Feb 8, 2023
9d9f56b
Add python 3.10 compatibility to README.md
JoelLefkowitz Feb 8, 2023
065b4f1
Update changelog
JoelLefkowitz Feb 9, 2023
6e40342
Fix: Provide enums support for schema.
onegreyonewhite Feb 11, 2023
1b2d89c
Fix: Tests for Python 3.11.
onegreyonewhite Feb 11, 2023
dcd0951
Refactoring: Removed old version code.
onegreyonewhite Feb 11, 2023
9286033
Fix: Linting is now working.
onegreyonewhite Feb 11, 2023
198dfb0
Fix: Provide usage of Enums as dict keys.
onegreyonewhite Feb 12, 2023
a6fe9a6
Fix: Docs build with latest sphinx versions.
onegreyonewhite Mar 1, 2023
87187b1
keep path parameters in their given order
terencehonles Mar 2, 2023
5530022
Merge pull request #841 from terencehonles/keep-path-parameter-ordering
JoelLefkowitz Mar 8, 2023
83aa352
Fix: Action build docs with latest tox version.
onegreyonewhite Mar 9, 2023
a00fd87
Fix: Update python version for dj-master branch.
onegreyonewhite Mar 16, 2023
353f071
Merge pull request #837 from onegreyonewhite/1.21.x
JoelLefkowitz Mar 16, 2023
afea1bc
Feature: Migrate to PyYAML for yaml generator. (#845)
onegreyonewhite May 16, 2023
a836b04
Fix: Remove required coreapi dependency. (#854)
onegreyonewhite Jun 15, 2023
24c4c1b
Update Changelog
Jun 15, 2023
106d7b2
Feature: Add ``drf_yasg.inspectors.query.DrfAPICompatInspector``. (#857)
onegreyonewhite Jul 4, 2023
5e239a8
[fix] Fixed map source mapping (#859)
pandafy Jul 13, 2023
2548298
Tests: Improve test coverage 95.91% -> 98.30%. (#862)
onegreyonewhite Jul 19, 2023
db42d35
Update Changelog
Jul 20, 2023
a96f0c4
fix: do not use scm version
itkovian Sep 20, 2024
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
176 changes: 176 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{
"language": "en",
"ignorePaths": [
"./app.json",
".gitignore",
"*.coverage",
"*.min.js",
"**/__pycache__/**",
"**/*.egg-info/**",
"**/*.git/**",
"**/build/**",
"**/coverage/**",
"**/dist/**",
"**/migrations/**",
"**/swagger-ui-dist/**",
"**/venv/**"
],
"dictionaries": [
"css",
"django",
"fonts",
"local",
"misc",
"python",
"softwareTerms"
],
"words": [
"addopts",
"apiview",
"askar",
"auths",
"authtoken",
"autoclass",
"autodata",
"automodule",
"avenir",
"barebones",
"basepath",
"beaugunderson",
"blueyed",
"builddir",
"bysource",
"cacheable",
"callabale",
"camelize",
"camelized",
"classdoc",
"codecov",
"codegen",
"coreapi",
"coreschema",
"corsheaders",
"coveragerc",
"cristi",
"cristian",
"cschema",
"csrfmiddlewaretoken",
"csrftoken",
"dascalescu",
"datadiff",
"deauth",
"deauthorize",
"deprecated",
"djangorestframework",
"djmaster",
"docstrings",
"documentclass",
"elnappo",
"envlist",
"eryk",
"exitfirst",
"extrahead",
"figwidth",
"filterset",
"formop",
"genindex",
"getdefault",
"ghuser",
"gunicorn",
"herokuapp",
"hirokawa",
"howto",
"htbp",
"htmlhelp",
"immutablehash",
"indentless",
"initkwargs",
"joellefkowitz",
"jsons",
"keepdb",
"keyframeprefix",
"letterpaper",
"levelname",
"linenos",
"maxdepth",
"minversion",
"modindex",
"monokai",
"myparent",
"napierała",
"nbsp",
"noscm",
"npmignore",
"odict",
"omap",
"paginators",
"papersize",
"passwordadmin",
"plugable",
"pointsize",
"popd",
"posargs",
"preauth",
"preauthorize",
"prepended",
"proxied",
"psycopg",
"pushd",
"putenv",
"pythonpath",
"pytz",
"qinsq",
"quickstart",
"rebilly",
"redoc",
"referenceable",
"reftest",
"refuri",
"regexes",
"representer",
"rsichny",
"rtype",
"ruamel",
"scrollbars",
"searchbox",
"serializers",
"setuptools",
"sidemenu",
"sourcedir",
"sphinxbuild",
"sphinxopts",
"sphinxproj",
"staticfiles",
"subclassing",
"swaggerapi",
"tenerowicz",
"testenv",
"testproj",
"therefromhere",
"toctree",
"undoc",
"unencrypted",
"uritemplate",
"urlconf",
"urlconfs",
"urlpatterns",
"versionadded",
"versionchanged",
"versionmodified",
"viewcode",
"viewset",
"viewsets",
"vigrond",
"vschema",
"whitenoise",
"wsgi",
"xdist",
"yasg",
"yasgdoc",
"yetanother",
"yetanothers",
"yourapp",
"yusupov",
"zbyszek"
]
}
29 changes: 29 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Install
description: Install dependencies

inputs:
python-version:
description: Python version for installing dependencies
required: true

runs:
using: composite
steps:
- name: Checkout the source code
uses: actions/checkout@v2

- name: Set the python version
uses: actions/setup-python@v3
with:
python-version: ${{ inputs.python-version }}

- name: Set up pip package caching
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
shell: bash
run: pip install -r requirements/ci.txt
16 changes: 10 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish

on:
push:
tags:
tags:
- "*.*.*"

jobs:
Expand All @@ -13,17 +13,21 @@ jobs:
- name: Checkout the source code
uses: actions/checkout@v2

- name: Set the python version
uses: actions/setup-python@v2

# This is the version of python used to package the code. The unit
# tests will have run against python 3.6, 3.7 etc ensuring
# tests will have run against python 3.6, 3.7 etc ensuring
# compatibility with those runtimes.
# https://github.com/axnsan12/drf-yasg/pull/741#discussion_r713297594
- name: Set the python version
uses: actions/setup-python@v3
with:
python-version: 3.8

- name: Install dependencies
uses: ./.github/actions/install
with:
python-version: 3.8

- name: Install pip dependencies
- name: Install builders for publishing
run: pip install -r requirements/publish.txt

- name: Build the distributions
Expand Down
38 changes: 24 additions & 14 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,39 @@ on: [push, pull_request]
jobs:
review:
name: Run linters and tests
runs-on: ubuntu-latest
runs-on: "ubuntu-20.04"
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- name: Set up pip package caching
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Checkout the source code
uses: actions/checkout@v2

- name: Set the python version
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
uses: ./.github/actions/install
with:
python-version: ${{ matrix.python }}

- name: Install pip dependencies
run: pip install -r requirements/ci.txt
- name: Run tests
env:
PYTHON_VERSION: ${{ matrix.python }}
run: tox -e $(tox -l | grep py${PYTHON_VERSION//.} | paste -sd "," -)

- name: Report coverage
if: ${{ matrix.python == 3.9 }}
run: |
pip install coverage
coverage report

- name: Run unit tests
run: tox
- name: Check for incompatibilities with publishing to PyPi
if: ${{ matrix.python == 3.8 }}
run: |
pip install -r requirements/publish.txt
python setup.py sdist
twine check dist/*
6 changes: 3 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You want to contribute some code? Great! Here are a few steps to get you started
$ python -m venv venv
$ source venv/bin/activate
(venv) $ python -m pip install -U pip setuptools
(venv) $ pip install -U -e .[validation]
(venv) $ pip install -U -e '.[validation]'
(venv) $ pip install -U -r requirements/dev.txt

#. **Make your changes and check them against the test project**
Expand Down Expand Up @@ -78,7 +78,7 @@ You want to contribute some code? Great! Here are a few steps to get you started

#. **Update documentation**

If the change modifies behaviour or adds new features, you should update the documentation and ``README.rst``
If the change modifies behavior or adds new features, you should update the documentation and ``README.rst``
accordingly. Documentation is written in reStructuredText and built using Sphinx. You can find the sources in the
``docs`` directory.

Expand All @@ -96,7 +96,7 @@ You want to contribute some code? Great! Here are a few steps to get you started
#. **Your code must pass all the required CI jobs before it is merged**

As of now, this consists of running on the supported Python, Django, DRF version matrix (see README),
and building the docs succesfully.
and building the docs successfully.

******************
Maintainer's notes
Expand Down
43 changes: 36 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Generate **real** Swagger/OpenAPI 2.0 specifications from a Django Rest Framewor

Compatible with

- **Django Rest Framework**: 3.10, 3.11, 3.12
- **Django**: 2.2, 3.0, 3.1
- **Python**: 3.6, 3.7, 3.8, 3.9
- **Django Rest Framework**: 3.10, 3.11, 3.12, 3.13, 3.14
- **Django**: 2.2, 3.0, 3.1, 3.2, 4.0, 4.1
- **Python**: 3.6, 3.7, 3.8, 3.9, 3.10, 3.11

Only the latest patch version of each ``major.minor`` series of Python, Django and Django REST Framework is supported.

Expand Down Expand Up @@ -132,6 +132,7 @@ In ``urls.py``:
.. code:: python

...
from django.urls import re_path
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
Expand All @@ -148,13 +149,13 @@ In ``urls.py``:
license=openapi.License(name="BSD License"),
),
public=True,
permission_classes=[permissions.AllowAny],
permission_classes=(permissions.AllowAny,),
)

urlpatterns = [
re_path(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
re_path(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
re_path(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
path('swagger<format>/', schema_view.without_ui(cache_timeout=0), name='schema-json'),
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
...
]

Expand Down Expand Up @@ -357,3 +358,31 @@ provided out of the box - if you have ``djangorestframework-recursive`` installe

.. |nbsp| unicode:: 0xA0
:trim:

drf-extra-fields
=================

Integration with `drf-extra-fields <https://github.com/Hipo/drf-extra-fields>`_ has a problem with Base64 fields.
The drf-yasg will generate Base64 file or image fields as Readonly and not required. Here is a workaround code
for display the Base64 fields correctly.

.. code:: python

class PDFBase64FileField(Base64FileField):
ALLOWED_TYPES = ['pdf']

class Meta:
swagger_schema_fields = {
'type': 'string',
'title': 'File Content',
'description': 'Content of the file base64 encoded',
'read_only': False # <-- FIX
}

def get_file_extension(self, filename, decoded_file):
try:
PyPDF2.PdfFileReader(io.BytesIO(decoded_file))
except PyPDF2.utils.PdfReadError as e:
logger.warning(e)
else:
return 'pdf'
Loading