django-rest-framework/rest_framework/schemas
Kevin Brown 86c72bb226 Fix schema generation of ManyRelatedField to detect the child type (#6489)
* Introspect ManyRelatedField data type recursively

For all `ManyRelatedField` objects, we were assuming that the inner type was always a `String`. While this may be true for the default output, a `ManyRelatedField` is a wrapper for a lot of other classes which includes more than just strings. This should allow us to document lists of things other than strings.

* Added test for schemas for many-to-many fields

This adds a test that makes sure we generate the schema for a many-to-many field such that it actually has the right type. For some reason we did not previously have any tests for schema generation that included them, so hopefully this will prevent any future issues from popping up.

This should serve as a regression test for the `items` field on to-many relationships, which was previously forced to a `String` even though in most cases it is a different inner type within the array.
2019-03-07 11:26:03 +01:00
..
__init__.py Add DEFAULT_SCHEMA_CLASS setting (#5658) 2017-12-14 11:24:21 +01:00
generators.py Fix typo in schemas (#6332) 2018-11-26 10:14:59 -08:00
inspectors.py Fix schema generation of ManyRelatedField to detect the child type (#6489) 2019-03-07 11:26:03 +01:00
utils.py Have is_list_view recognise RetrieveModel… views (#5480) 2017-10-05 20:41:14 +02:00
views.py Fixed SchemaView to reset renderer on exception. (#6429) 2019-01-31 15:28:01 +01:00