Commit Graph

38 Commits (db61c39ab1542f10f1c586e6364723340a81d2da)

Author SHA1 Message Date
Cristi Vîjdea db61c39ab1 Fix union types in sphinx docstrings 2018-12-21 15:04:25 +02:00
Cristi Vîjdea 3b31c54b9e Add get_security_definitions and get_security_requirements hooks 2018-12-21 12:40:45 +02:00
Cristi Vîjdea a9ec14620c Fix security definitions ordering consistency 2018-12-21 02:04:15 +02:00
Cristi Vîjdea 20786e53c3 Provide more OpenAPISchemaGenerator extension points
Add ``should_include_endpoint`` and ``get_paths_object``.
2018-09-13 05:51:34 +03:00
Cristi Vîjdea 90812f5c43 Refactor get_queryset_from_view 2018-09-10 14:34:30 +03:00
Terence D. Honles f9b215deab Fix missing backslashes found via pytest 3.8 (#202)
See: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

Changed in version 3.6: Unrecognized escape sequences produce a DeprecationWarning

Closes #202.
2018-09-09 22:17:04 +03:00
Cristi Vîjdea 5cd642c9a0 Show warning on ref_name collisions
Closes #156
2018-08-08 00:58:35 +03:00
Cristi Vîjdea 2965e08e39 Force descriptions to be str objects
Fixes #159
2018-08-03 20:27:31 +03:00
Xiaohan Zhang 178390a9a0 Add get_default_response_serializer extension point (#153)
Enables easier request/response differentiation in SwaggerAutoSchema.
2018-06-30 00:26:29 +03:00
Jack Cushman 544d72db0a Handle duplicate urls in urlconf (#155)
Django resolves urls in order from top to bottom, and only uses the first matching URL found.
2018-06-29 22:57:37 +03:00
Cristi Vîjdea 696ec3a94a Add swagger_fake_view marker to help detect fake views in get_serializer
Cleaner fix for #154
2018-06-29 18:00:54 +03:00
Cristi Vîjdea cc90bc1544 Add some coverage exemptions 2018-05-30 22:33:36 +03:00
Cristi Vîjdea a4a11ad1ab Prevent crash when ViewInspector.get_operation returns None 2018-05-14 22:10:13 +03:00
Cristi Vîjdea ae5eeeb600 Ignore None return from get_operation 2018-05-14 18:36:44 +03:00
Cristi Vîjdea 23ebe2ff3e Guard against views that throw exceptions from __init__ 2018-05-12 18:14:33 +03:00
Cristi Vîjdea 2545ae9657 Fix SECURITY_REQUIREMENT order (again)
pain in the ass -.-
2018-05-12 14:11:37 +03:00
Cristi Vîjdea f03d9d71e9 Fix SECURITY_DEFINITIONS and SECURITY_REQUIREMENTS ordering 2018-05-12 13:54:43 +03:00
Cristi Vîjdea a993cba7aa Fix default security requirements 2018-05-12 13:35:17 +03:00
Cristi Vîjdea bd727fbe88 Update swagger-ui to 3.14.1
Add settings key for ``showCommonExtensions``
2018-05-05 15:33:38 +03:00
John Carter 322971f3e7 Make parameters order stable for multi-parameter URLs (#106)
Fixes #105

* Added intermittently failing test for #105
* Make parameter order stable for urls with multiple params
2018-04-23 19:16:22 +03:00
ko-pp 309a6eb8cd Fix schema generation with OneToOneFields (#81)
* Fix: OneToOneRel, used by OneToOneField doesn't have help_text nor primary_key attributes, thus breaking OpenAPISchemaGenerator; use hasattr() as safe-guard.
* Fix: use getattr() with a default value instead of hasattr() + acessing the value
* Add: 'people' app that breaks drf_yasg without previous commits
* Update tests/references.yaml + run isort and flake8
* Fix: set on_delete for Person.identity as Django-2+ requires it
2018-03-18 19:30:36 +02:00
Cristi Vîjdea 9ad55bac99 Guard against attempted deletion of inexistent attributes
Fixes #76
2018-03-05 19:59:03 +02:00
Cristi Vîjdea 6ea8711a1f
Fix in-place modification of swagger_auto_schema arguments (#75)
Fixes #74
2018-03-05 11:51:51 +02:00
Cristi Vîjdea b38d3e6805 Do not set pattern on non-string values
Fixes #68
2018-02-23 18:51:55 +02:00
Cristi Vîjdea a211184478 Add documentation about excluding endpoints
Closes #50.
2018-01-24 17:38:10 +02:00
Cristi Vîjdea a3e81ef7f6
Improve handling of consumes and produces attributes (#55)
* Fix get_consumes
* Generate produces for Operation
* Set global consumes and produces from rest framework DEFAULT_ settings
2018-01-24 14:44:00 +02:00
Cristi Vîjdea fc35d9043e
Add security requirements handling (#54)
* Add security requirements handling
* Update swagger-ui to 3.9.2, ReDoc to 1.20.0

Closes #39.
2018-01-23 12:43:25 +02:00
Daniel Hahler a82730d32b Fix logging message in get_path_from_regex (#49)
Adds the missing param.
2018-01-17 21:49:22 +01:00
Cristi Vîjdea bc4037f721 Fix coverage problems 2018-01-12 04:36:04 +01:00
Cristi Vîjdea 7a3fe8ec0c
Improve host, schemes and basePath handling (#42)
* added handling of basePath by taking into account SCRIPT_NAME and the longest common prefix
* improved handling of NamespaceVersioning by excluding URLs of differing versions
* added documentation and error messages for the problem reported in #37
2018-01-12 03:37:04 +01:00
Cristi Vîjdea d39764d383 Add isort 2017-12-27 20:23:05 +01:00
Beau Gunderson 1f190744cd Add 'generate_swagger' management command (#31)
Closes #29.
2017-12-27 20:00:24 +01:00
Cristi Vîjdea c89f96fcb0
Prepare for 1.1.0 (#30)
* refactor the view inspection process to be more modular and allow recursive customization
* add operation_id argument to @swagger_auto_
* add inspections for min/max validators
* add support for URLPathVersioning and NamespaceVersioning
* integrate with djangorestframework-camel-case
* fix bugs, improve tests and documentation
2017-12-26 22:50:59 +01:00
Cristi Vîjdea 9f6ee4da87 Improve RelatedField and callable default handling
- callable default values will now be properly called 
  - PrimaryKeyRelatedField and SlugRelatedField will now return an appropriate type based on the relation model's Field
  - mock views now have a request object bound even when public is True
2017-12-23 11:52:57 +01:00
Nicolas Delaby f05889292a Add type inspection for PrimaryKeyRelatedField (#26)
Guess the type for PrimaryKeyRelatedField from the related ModelField.
2017-12-22 21:00:13 +01:00
Cristi Vîjdea 6060192a89 Update changelog and clean up code 2017-12-18 14:23:57 +01:00
Cristi Vîjdea 521172c195 Clean up Django 2 path backslashes
In Django 2, routes defines via urls.path are aggresively escaped when converted into regex.

This is a naive fix which unescapes all characters outside capture groups, but in the context of OpenAPI is okay because regular expressions inside paths are not supported anyway.

This issue affects django-rest-framework as well, as outlined in encode/django-rest-framework#5672, encode/django-rest-framework#5675.
2017-12-18 01:06:14 +01:00
Cristi Vîjdea c66f7e8e01 Rename to drf-yasg
drf-swagger was already taken
2017-12-13 10:22:03 +01:00