Commit Graph

53 Commits (de3c5a77fd773ea2570b58212121458a63ceacc2)

Author SHA1 Message Date
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 1184ea8b46 Add --generator-class argument to management command
Closes #140
2018-06-16 15:54:51 +03:00
Cristi Vîjdea 6ac58b8cf7 Fix testproj duplicate operation id
Fixes #139
2018-06-16 15:41:51 +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 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 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
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
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
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 c9147a5746 Fix testproj people app 2018-03-18 20:20:04 +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
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
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
Cristi Vîjdea f15e70b7db Fix missing assignment for default in openapi.Parameter 2018-02-22 20:33:47 +02:00
Cristi Vîjdea 64c280e222 Allow Response objects with no schema
Fixes #66.
2018-02-22 03:46:44 +02:00
Cristi Vîjdea d5073081d9
Fix ModelViewSet Nested bug (#65)
* Add todo repro app
* Add explicit test against model named "Nested"
* Force serializers named NestedSerializer to be output as inline models
* Allow ref_name to rescue a NestedSerializer
* Add tests and documentation
2018-02-22 03:46:16 +02:00
Cristi Vîjdea 97cd1b63d9 Take coerce_to_string into account when handling DecimalField
Closes #62.
2018-02-21 04:42:34 +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
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 6a478e14d7 Add overriden path parameter example 2018-01-11 21:20:54 +01:00
Cristi Vîjdea c4379dc6a7
Run testproj in a Heroku demo app (#38)
* Add Heroku configuration
* Add links in API description
* Read database connection string from DATABASE_URL environment variable
* Restructure settings files for production
* Run server using gunicorn and servce static files with whitenoise
* Install drf-yasg from source instead of pypi in testproj
* Add readme links to demo app
2018-01-10 10:18:22 +01:00
Cristi Vîjdea 68b0dda0b9 Clean up and release 1.1.3 2018-01-02 22:27:09 +01:00
Cristi Vîjdea 02b72c466e Do not generate readOnly outside Schema properties 2018-01-01 19:16:20 +01:00
Cristi Vîjdea ee4789776a Fix isort inconsistency 2017-12-27 20:47:32 +01:00
Cristi Vîjdea 22853b87c7 Fix test_noop_inspectors 2017-12-27 20:23:21 +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 c85acee405 Convert regex '\Z' to '$'
See https://github.com/swagger-api/swagger-editor/issues/1601.
2017-12-27 03:00:47 +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 8a8a9faeeb Fix swagger Try it out and make endpoints work 2017-12-21 17:20:46 +01:00
Cristi Vîjdea 06a461ec09
Merge pull request #21 from h-hirokawa/file-field-response
Add support for FileField response.
2017-12-18 13:16:21 +01:00
h-hirokawa 16b697b40d Add a field to ArticleSerializer in testproj for coverage. 2017-12-18 19:31:32 +09:00
h-hirokawa 8a0d5a964d Add support for serializers.FileField response. 2017-12-18 19:03:40 +09:00
Cristi Vîjdea da4b7d4e74 Fix test to account for changed description
See 8a5be407e2.
2017-12-17 02:36:48 +01:00
Cristi Vîjdea 8a5be407e2 Document exotic usages of swagger_auto_schema
method_decorator works out of the box so might as well document an example
2017-12-16 20:38:40 +01:00
Cristi Vîjdea a2c21539f7
Prepare release 1.0.4 2017-12-16 18:18:21 +01:00
Cristi Vîjdea 73bd7a136d
Add query_serializer argument to swagger_auto_schema (#17)
Closes #16.
2017-12-16 15:37:42 +01:00
Cristi Vîjdea 174f1153b4
Fix broken SwaggerDict pickling (#15)
Closes #14.
2017-12-15 18:47:10 +01:00
Cristi Vîjdea f6a535eb45 Do not attempt to generate a response schema for form-only requests
It would probably fail because Schema objects cannot represent files
2017-12-15 11:14:47 +01:00
Cristi Vîjdea c66f7e8e01 Rename to drf-yasg
drf-swagger was already taken
2017-12-13 10:22:03 +01:00
Cristi Vîjdea 8883894775
Add more tests and cleanup coverage reports (#13)
Closes #11
2017-12-12 17:30:58 +01:00
Cristi Vîjdea bfced82ae4
Add suport for Response schemas (#10)
Schemas generated from Serializers will now be added to the `definitions` section by default, and used as `$ref` objects where needed.  
The Schema definition name is based on the serializer class name, and can be overriden by specifying a `__ref_name__` property on the Serializer. If this property is set to None, the schema will not be added to `definitions` and will be forced inline.

Closes #6, #7.
2017-12-10 03:06:49 +01:00
Cristi Vîjdea 652795f5db Add swagger_auto_schema method decorator for Operation customization
See #5.
2017-12-08 17:45:00 +01:00