@@ -19,5 +19,46 @@ DRF_STANDARDIZED_ERRORS = {
1919 # {field}{NESTED_FIELD_SEPARATOR}{nested_field}
2020 # for example: 'shipping_address.zipcode'
2121 " NESTED_FIELD_SEPARATOR" : " ." ,
22+
23+ # The below settings are for OpenAPI 3 schema generation
24+
25+ # ONLY the responses that correspond to these status codes will appear
26+ # in the API schema.
27+ " ALLOWED_ERROR_STATUS_CODES" : [
28+ " 400" ,
29+ " 401" ,
30+ " 403" ,
31+ " 404" ,
32+ " 405" ,
33+ " 406" ,
34+ " 415" ,
35+ " 429" ,
36+ " 500" ,
37+ ],
38+
39+ # A mapping used to override the default serializers used to describe
40+ # the error response. The key is the status code and the value is a string
41+ # that represents the path to the serializer class that describes the
42+ # error response.
43+ " ERROR_SCHEMAS" : None ,
44+
45+ # When there is a validation error in list serializers, the "attr" returned
46+ # will be sth like "0.email", "1.email", "2.email", ... So, to describe
47+ # the error codes linked to the same field in a list serializer, the field
48+ # will appear in the schema with the name "INDEX.email"
49+ " LIST_INDEX_IN_API_SCHEMA" : " INDEX" ,
50+
51+ # When there is a validation error in a DictField with the name "extra_data",
52+ # the "attr" returned will be sth like "extra_data.<key1>", "extra_data.<key2>",
53+ # "extra_data.<key3>", ... Since the keys of a DictField are not predetermined,
54+ # this setting is used as a common name to be used in the API schema. So, the
55+ # corresponding "attr" value for the previous example will be "extra_data.KEY"
56+ " DICT_KEY_IN_API_SCHEMA" : " KEY" ,
57+
58+ # should be unique to error components since it is used to identify error
59+ # components generated dynamically to exclude them from being processed by
60+ # the postprocessing hook. This avoids raising warnings for "code" and "attr"
61+ # which can have the same choices across multiple serializers.
62+ " ERROR_COMPONENT_NAME_SUFFIX" : " ErrorComponent" ,
2263}
2364```
0 commit comments