Commit Graph

210 Commits (1fe8c2c03ce9cb22796469add4821c22ebb511c1)

Author SHA1 Message Date
Cristi Vîjdea cbae10c434 Refactor CamelCaseJSONFilter to be more extensible 2018-10-09 01:37:32 +03: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 120c4dd884 Fix IPv4 pattern on Django 1.11 2018-09-13 05:14:08 +03:00
Cristi Vîjdea 9d330d9509 Use the first line of view method docstring as Operation summary
Closes #205.
2018-09-13 04:18:55 +03:00
Cristi Vîjdea c8f6d16891 Update ReDoc to 2.0.0-alpha.38 2018-09-13 03:44:10 +03:00
Cristi Vîjdea 857ef05b07 Handle reverse_lazy
Fixes #209.
2018-09-13 03:38:13 +03:00
Cristi Vîjdea 586b88d8f3 Allow pattern on any field 2018-09-13 03:34:01 +03:00
Cristi Vîjdea 27cd5f7f2a Add some convenience methods 2018-09-11 02:41:55 +03:00
Cristi Vîjdea 90812f5c43 Refactor get_queryset_from_view 2018-09-10 14:34:30 +03:00
Cristi Vîjdea 91530b64c6 Add DISPLAY_OPERATION_ID setting for swagger-ui
Closes #206.
2018-09-10 14:02:25 +03:00
Cristi Vîjdea 6820d6bc70 Fix RelatedFieldInspector nesting issues 2018-09-10 05:04:03 +03:00
Cristi Vîjdea f50ad29a2b Fix lint errors 2018-09-10 02:48:08 +03:00
Cristi Vîjdea 27e38101a4 Add customization blocks to ui templates
Closes #178.
2018-09-10 02:41:02 +03:00
Cristi Vîjdea 4bac38e67b Update ReDoc settings 2018-09-10 01:39:57 +03:00
Cristi Vîjdea 0654aefe58 Update swagger-ui to 3.18.2 and ReDoc to 2.0.0-alpha.37 2018-09-10 00:13:39 +03:00
Cristi Vîjdea 41b1ca4483 Do not bail on response when request body is formData 2018-09-10 00:02:39 +03:00
Cristi Vîjdea 591c12f1a7 Fix request_body=no_body handling
Fixes #188, #199.
2018-09-09 23:14:09 +03:00
Cristi Vîjdea 271918a678 Fix empty swagger_auto_schema return value 2018-09-09 23:14:09 +03:00
Cristi Vîjdea c5c40e31c4 Log regex compilation failure in find_regex
Closes #193.
2018-09-09 22:33:13 +03:00
Cristi Vîjdea 3ac6c9ec3a Remove dependency on future
Sole use was raise_from. 

six.raise_from loses exception detail on Python 2, so god help the programmers of the past.

Fixes #196.
2018-09-09 22:29:11 +03:00
Cristi Vîjdea 5fa35d5b81 Check for None before calling to_representation
Django REST Framework also does this in serializers.

https://github.com/encode/django-rest-framework/issues/2299
4d57d46bf8/rest_framework/serializers.py (L518)

Fixes #203.
2018-09-09 22:22:58 +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
Nour Chawich 0837873f55 Add missing overrides to `swagger_auto_schema` (#194)
Add missing `operation_summary` and `deprecated` to `swagger_auto_schema` decorator data. The previous PR missed adding these to extra overrides.

- Added tests
- Updated reference.yaml

Refs #149, #173.
Closes #194, #198.
2018-09-09 22:15:50 +03:00
Julian Bez 02b8848912 Fix error when using typing classes (#195)
Closes #195.
2018-09-09 22:11:29 +03:00
Cristi Vîjdea 6e39a58b2d Defer settings imports to avoid ImportErrors 2018-09-09 21:56:26 +03:00
Cristi Vîjdea ec7529399e Fix swagger-ui style when session auth is disabled 2018-09-09 21:56:26 +03:00
Cristi Vîjdea 9b56e1a4c8 Avoid invalid usage of readOnly 2018-08-09 04:27:08 +03:00
Cristi Vîjdea 608abaf0e1 Fuck this test 2018-08-09 04:02:35 +03:00
Cristi Vîjdea d1ae81a27e Fix relative imports 2018-08-09 03:52:09 +03:00
Cristi Vîjdea cd4bd4a18e Add SPEC_URL setting 2018-08-09 03:32:04 +03:00
Cristi Vîjdea 8a69f08c29 Update ReDoc to 2.0.0-alpha.34 2018-08-09 03:15:08 +03:00
Cristi Vîjdea e533b0827a Add ReDoc 1.x.x renderer 2018-08-09 03:14:08 +03:00
Cristi Vîjdea 23ebba4207 Rename swagger_serializer_method parameter and update docs 2018-08-08 01:41:54 +03:00
Cristi Vîjdea 12f1d23048 Fix lint errors 2018-08-08 01:24:36 +03:00
Cristi Vîjdea a5eb3dfa91 Add EXCLUDED_MEDIA_TYPES setting
Closes #158.
2018-08-08 00:59:01 +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 3f2d2871f0 Update swagger-ui to 3.18.0 2018-08-08 00:58:08 +03:00
Cristi Vîjdea 247c1a306a Add `operation_summary` and `deprecated` to `swagger_auto_schema`
Closes #149, #173.
2018-08-08 00:57:30 +03:00
Cristi Vîjdea 37c00ab3fb Make swagger_schema_fields work on serializer Fields
Closes #167.
2018-08-07 22:54:24 +03:00
Cristi Vîjdea 65aac1da2c Make swagger_auto_schema work with action mappings
Fixes #177.
2018-08-07 22:38:36 +03:00
Cristi Vîjdea 4c069138e8 Fix lint errors 2018-08-07 21:24:36 +03:00
John Carter 748b5d3c2f Add support for SerializerMethodField (#179)
Closes #137, #179.
2018-08-07 21:23:36 +03:00
John Carter 1dd7cfe043 Spelling fixes (#180) 2018-08-07 17:30:13 +03:00
Cristi Vîjdea 16b6ed7fd6
Test with Django 2.1 and Python 3.7 (#176)
* Test with Django 2.1 and Python 3.7
* Fix lint errors
* Remove setuptools-scm hack
* Factor out coverage script
* Cache .tox in travis
* Update README & docs
2018-08-06 12:24:56 +03:00
Cristi Vîjdea 904895ba3c Add 1.9.2 changelog 2018-08-03 23:43:52 +03:00
Cristi Vîjdea 79adfc19be Update swagger-ui to 3.17.6 and ReDoc to 2.0.0-alpha.32 2018-08-03 20:27:41 +03:00
Cristi Vîjdea 2965e08e39 Force descriptions to be str objects
Fixes #159
2018-08-03 20:27:31 +03:00
Amoki bbc70a7e3d Allow specific version generation in command
* Add --api-version parameter
* Fix request mocking
* Add tests
2018-08-03 16:43:26 +03:00
Étienne Noss db86981dc1 make generate_swagger work for projects without authentication (#161)
* make generate_swagger work for projects without authentication
* use get_user_model instead of importing User
2018-07-06 16:13:19 +03:00
Cristi Vîjdea 20370d912e Update swagger-ui to 3.17.1 and ReDoc to 2.0.0-alpha.25 2018-06-30 00:32:07 +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
Cristi Vîjdea 9fa4765121 Ignore None when passed in as response override
Closes #148
2018-06-29 23:13:36 +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 e0aec3ff45 Test that get_serializer is not called when overriden
Views' ``get_serializer`` methods should not be called when the serializer is provided by ``request_body`` or ``responses``.

Closes #154
2018-06-29 17:41:41 +03:00
Andrew Yager 4825ec70b1 Handle swagger_extra_fields in field_to_swagger_object (#142)
* Move add_manual_fields call to make_schema_definition
* Do not call add_manual_fields twice
2018-06-16 17:02:06 +03:00
Cristi Vîjdea 1184ea8b46 Add --generator-class argument to management command
Closes #140
2018-06-16 15:54:51 +03:00
Cristi Vîjdea d627a1bc5d Handle coreapi Fields without a schema attribute
Fixes #143
2018-06-16 15:08:59 +03:00
Cristi Vîjdea 38e884b5ea Remove wrong 'count' in paginator response required fields
Fixes #141
2018-06-16 15:06:09 +03:00
Cristi Vîjdea 2ef7cfbfe3 Catch and log exceptions raised from get_serializer
Fixes #135
2018-06-01 16:21:25 +03:00
Cristi Vîjdea 58adbb8f4c Coerce read_only into a boolean 2018-06-01 15:36:37 +03:00
Cristi Vîjdea 34c7fa2b0e Update swagger-ui to 3.16.0 and ReDoc to 2.0.0-alpha.22 2018-05-31 00:35:11 +03:00
Cristi Vîjdea 256a052564
Add ability to set Schema fields through the serializer Meta class (#134)
* Add swagger_schema_fields attribute to serializer Meta class
* Add documentation

Closes #132.
2018-05-31 00:15:21 +03:00
Cristi Vîjdea cc90bc1544 Add some coverage exemptions 2018-05-30 22:33:36 +03:00
Terence Honles ecee6f8177 apply fix from #58 to _SpecRenderer (#130)
* apply fix from #58 to _SpecRenderer
* Use JSONRenderer instead of HTML
2018-05-30 22:03:00 +03:00
werwty 408b31fc4f Avoid marking read_only fields as required (#133)
* Avoid marking read_only fields as required

Read only properties cannot be marked as required by a schema.
2018-05-30 21:56:52 +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 aca0c4713e
Allow body on HTTP DELETE view methods (#122)
* Allow body in delete requests
* Do not add request body to DELETE by default
* Check manual form parameters against body_methods
* Add tests
* Add changelog

Closes #118
2018-05-14 19:15:14 +03:00
Cristi Vîjdea 3077195396 Update swagger-ui to 3.14.2 and ReDoc to 2.0.0-alpha.20 2018-05-14 18:59:59 +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 bfd88cbdb4 Fix security type hint 2018-05-12 13:30:57 +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
Fabian Weisshaar 5b225423ae Set min_length=1 when allow_blank=False (#112) 2018-04-27 13:02:26 +03:00
Cristi Vîjdea 209201b9a5 Make insertion order of SwaggerDict extra parameters consistent 2018-04-27 12:12:36 +03:00
Cristi Vîjdea 4e7fa28744 Superficial fixes 2018-04-27 01:53:05 +03:00
Roman Sichny 979ec84630 Django rest framework recursive support (#110)
* add get_serializer_ref_name utility function
* implement RecursiveFieldInspector
* add option to allow non-existing reference in SchemaRef
* add examples and README
* Update changelog and docs
2018-04-27 01:51:10 +03:00
Cristi Vîjdea aa90723703 Switch to redoc 2.0 alpha
Update redoc to 2.0.0-alpha.17
2018-04-25 22:55:25 +03:00
Cristi Vîjdea 301511bebc Update swagger-ui to 3.13.6 2018-04-25 22:44:49 +03:00
Cristi Vîjdea c0f37f6ec1 Avoid crash when hitting unknown model fields
Fixes #102
2018-04-25 22:41:06 +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
Cristi Vîjdea 6dd8ded05d Update swagger-ui to 3.13.3 2018-04-09 13:55:17 +03:00
Cristi Vîjdea 7270154828
Test with Django Rest Framework 3.8 (#96)
* Add djangorestframework 3.8 to tox and travis
* Add @action tests
* Limit tox to <3.0.0
2018-04-04 22:59:57 +03:00
shahha 941ec8fdaf Added SUPPORTED_SUBMIT_METHODS swagger ui setting (#91) 2018-03-26 11:15:28 +03:00
Cristi Vîjdea 51ec07261d
Improve OAuth2 behaviour and documentation (#90)
* Set OAUTH2_REDIRECT_URL to oauth2-redirect.html by default
* Add example SWAGGER_SETTINGS for OAuth
* Add note about redirect URL
2018-03-24 13:05:37 +02:00
Cristi Vîjdea a9cdf6d561 Fix type of properties in Schema docstring
Fixes #87.
2018-03-21 13:39:14 +02:00
Cristi Vîjdea ccdf646c0e Run isort 2018-03-18 20:01:21 +02:00
Cristi Vîjdea 04252ebec3 Remove reodc-alpha artifacts 2018-03-18 19:52:16 +02:00
Cristi Vîjdea 848fb69009 Update swagger-ui to 3.13.0 2018-03-18 19:32:21 +02: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 66785b1ee8 Update swagger-ui to 3.12.1 2018-03-12 19:06:20 +02:00
John Carter fb240f6a5b Detect type of SlugRelatedField with readonly=True (#83)
* Added test for #82 - readonly SlugRelatedField not showing format uuid
* Added ArticleGroup model
* Added example of SlugRelatedField to a uuid field with and without readonly
* Check remote_field.model in get_related_model

Closes #82.
2018-03-10 13:29:20 +02:00
John Carter 2c459024d1 Handle django rest framework HiddenField (#79)
* Added HiddenFieldInspector (#78)
* Updated docs + added test for HiddenField

Added HiddenField to testproj (no change in yaml as expected)

Closes #78.
2018-03-09 22:46:47 +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 3d3b7899e5 Update swagger-ui to 3.12.0 and ReDoc to 1.21.2 2018-03-05 17:07:45 +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 ee46f59fb1 Infer ChoiceField type from model field when in ModelSerializer
Fixes part of issue #69
2018-02-26 20:32:57 +02:00