1 # Copyright 2018 ZTE Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from rest_framework import serializers
18 class ProblemDetailsSerializer(serializers.Serializer):
19 type = serializers.CharField(
20 help_text='A URI reference according to IETF RFC 3986 [10] that identifies the problem type. \
21 It is encouraged that the URI provides human-readable documentation for the problem (e.g. using HTML) when dereferenced. \
22 When this member is not present, its value is assumed to be "about:blank".',
27 title = serializers.CharField(
28 help_text='A short, human-readable summary of the problem type. \
29 It should not change from occurrence to occurrence of the problem, except for purposes of localization. \
30 If type is given and other than "about:blank", this attribute shall also be provided.',
35 title = serializers.IntegerField(
36 help_text='The HTTP status code for this occurrence of the problem.',
40 detail = serializers.CharField(
41 help_text='A human-readable explanation specific to this occurrence of the problem.',
46 instance = serializers.CharField(
47 help_text='A URI reference that identifies the specific occurrence of the problem. \
48 It may yield further information if dereferenced.',
53 additional_attributes = serializers.DictField(
54 help_text='Any number of additional attributes, as defined in a specification or by an implementation.',
55 child=serializers.CharField(help_text='Additional attribute', allow_blank=True),