1
- from openapi_core .schema .exceptions import OpenAPIMappingError
2
-
3
1
import attr
4
2
3
+ from openapi_core .schema .exceptions import OpenAPIMappingError
4
+
5
5
6
6
class OpenAPISchemaError (OpenAPIMappingError ):
7
7
pass
8
8
9
9
10
- @attr .s
10
+ @attr .s ( frozen = True )
11
11
class NoValidSchema (OpenAPISchemaError ):
12
12
value = attr .ib ()
13
13
14
14
def __str__ (self ):
15
15
return "No valid schema found for value: {0}" .format (self .value )
16
16
17
17
18
- @attr .s
18
+ @attr .s ( frozen = True )
19
19
class UndefinedItemsSchema (OpenAPISchemaError ):
20
20
type = attr .ib ()
21
21
22
22
def __str__ (self ):
23
23
return "Null value for schema type {0}" .format (self .type )
24
24
25
25
26
- @attr .s
26
+ @attr .s ( frozen = True )
27
27
class InvalidSchemaValue (OpenAPISchemaError ):
28
28
msg = attr .ib ()
29
29
value = attr .ib ()
@@ -32,58 +32,60 @@ class InvalidSchemaValue(OpenAPISchemaError):
32
32
def __str__ (self ):
33
33
return self .msg .format (value = self .value , type = self .type )
34
34
35
- @attr .s
35
+
36
+ @attr .s (frozen = True )
36
37
class InvalidCustomFormatSchemaValue (InvalidSchemaValue ):
37
38
original_exception = attr .ib ()
38
39
39
40
def __str__ (self ):
40
41
return self .msg .format (value = self .value , type = self .type , exception = self .original_exception )
41
42
42
43
43
- @attr .s
44
+ @attr .s ( frozen = True )
44
45
class UndefinedSchemaProperty (OpenAPISchemaError ):
45
46
extra_props = attr .ib ()
46
47
47
48
def __str__ (self ):
48
49
return "Extra unexpected properties found in schema: {0}" .format (self .extra_props )
49
50
50
- @attr .s
51
+
52
+ @attr .s (frozen = True )
51
53
class InvalidSchemaProperty (OpenAPISchemaError ):
52
54
property_name = attr .ib ()
53
55
original_exception = attr .ib ()
54
56
55
57
def __str__ (self ):
56
58
return "Invalid schema property {0}: {1}" .format (self .property_name , self .original_exception )
57
59
58
- @attr .s
60
+
61
+ @attr .s (frozen = True )
59
62
class MissingSchemaProperty (OpenAPISchemaError ):
60
63
property_name = attr .ib ()
61
64
62
65
def __str__ (self ):
63
66
return "Missing schema property: {0}" .format (self .property_name )
64
67
65
68
66
- @attr .s
69
+ @attr .s ( frozen = True )
67
70
class NoOneOfSchema (OpenAPISchemaError ):
68
71
type = attr .ib ()
69
72
70
73
def __str__ (self ):
71
74
return "Exactly one valid schema type {0} should be valid, None found." .format (self .type )
72
75
73
76
74
- @attr .s
77
+ @attr .s ( frozen = True )
75
78
class MultipleOneOfSchema (OpenAPISchemaError ):
76
79
type = attr .ib ()
77
80
78
81
def __str__ (self ):
79
82
return "Exactly one schema type {0} should be valid, more than one found" .format (self .type )
80
83
81
84
82
- class UnmarshallerError (Exception ):
85
+ class UnmarshallerError (OpenAPIMappingError ):
83
86
pass
84
87
85
88
86
- @attr .s
87
89
class UnmarshallerStrictTypeError (UnmarshallerError ):
88
90
value = attr .ib ()
89
91
types = attr .ib ()
0 commit comments