parent
313d122004
commit
3c3631dbd0
|
|
@ -3,6 +3,17 @@ Changelog
|
|||
#########
|
||||
|
||||
|
||||
*********
|
||||
**1.0.6**
|
||||
*********
|
||||
|
||||
- **FIXED:** Swagger UI "Try it out!" should now work with Django login
|
||||
- **FIXED:** callable ``default`` values on serializer fields will now be properly called (:pr:`24`, :issue:`25`)
|
||||
- **IMPROVED:** updated ``swagger-ui`` to version 3.8.0
|
||||
- **IMPROVED:** ``PrimaryKeyRelatedField`` and ``SlugRelatedField`` will now have
|
||||
appropriate types based on the related model (:pr:`26`)
|
||||
- **IMPROVED:** mock views will now have a bound request even with ``public=False`` (:pr:`23`)
|
||||
|
||||
*********
|
||||
**1.0.5**
|
||||
*********
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ def inspect_model_field(model, model_field):
|
|||
if isinstance(model_field, model_field_class):
|
||||
swagger_type, format = tf
|
||||
break
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
swagger_type, format = None, None
|
||||
|
||||
if format is None or format == openapi.FORMAT_SLUG:
|
||||
|
|
@ -274,7 +274,7 @@ def serializer_field_to_swagger(field, swagger_object_type, definitions=None, **
|
|||
if hasattr(default, 'set_context'):
|
||||
default.set_context(field)
|
||||
default = default()
|
||||
except Exception as e:
|
||||
except Exception as e: # pragma: no cover
|
||||
logger.warning("default for %s is callable but it raised an exception when "
|
||||
"called; 'default' field will not be added to schema", field, exc_info=True)
|
||||
default = None
|
||||
|
|
@ -285,7 +285,7 @@ def serializer_field_to_swagger(field, swagger_object_type, definitions=None, **
|
|||
# JSON roundtrip ensures that the value is valid JSON;
|
||||
# for example, sets get transformed into lists
|
||||
default = json.loads(json.dumps(default, cls=encoders.JSONEncoder))
|
||||
except Exception:
|
||||
except Exception: # pragma: no cover
|
||||
logger.warning("'default' on schema for %s will not be set because "
|
||||
"to_representation raised an exception", field, exc_info=True)
|
||||
default = None
|
||||
|
|
@ -367,7 +367,7 @@ def serializer_field_to_swagger(field, swagger_object_type, definitions=None, **
|
|||
try:
|
||||
model = field.queryset.model
|
||||
pk_field = model._meta.pk
|
||||
except Exception:
|
||||
except Exception: # pragma: no cover
|
||||
logger.warning("an exception was raised when attempting to extract the primary key related to %s; "
|
||||
"falling back to plain string" % field, exc_info=True)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue