Quellcode durchsuchen

fix schema_class_resolver method usage

Guénaël Muller vor 6 Jahren
Ursprung
Commit
87271c71c4
1 geänderte Dateien mit 21 neuen und 6 gelöschten Zeilen
  1. 21 6
      hapic/doc.py

+ 21 - 6
hapic/doc.py Datei anzeigen

24
     # schema based
24
     # schema based
25
     if description.input_body:
25
     if description.input_body:
26
         schema_class = spec.schema_class_resolver(
26
         schema_class = spec.schema_class_resolver(
27
-            description.input_body.wrapper.processor.schema)
27
+            spec,
28
+            description.input_body.wrapper.processor.schema
29
+        )
28
         method_operations.setdefault('parameters', []).append({
30
         method_operations.setdefault('parameters', []).append({
29
             'in': 'body',
31
             'in': 'body',
30
             'name': 'body',
32
             'name': 'body',
31
             'schema': {
33
             'schema': {
32
                 '$ref': '#/definitions/{}'.format(
34
                 '$ref': '#/definitions/{}'.format(
33
-                    spec.schema_name_resolver(schema_class))
35
+                    spec.schema_name_resolver(schema_class)
36
+                )
34
             }
37
             }
35
         })
38
         })
36
 
39
 
37
     if description.output_body:
40
     if description.output_body:
38
         schema_class = spec.schema_class_resolver(
41
         schema_class = spec.schema_class_resolver(
39
-            description.output_body.wrapper.processor.schema)
42
+            spec,
43
+            description.output_body.wrapper.processor.schema
44
+        )
40
         method_operations.setdefault('responses', {})\
45
         method_operations.setdefault('responses', {})\
41
             [int(description.output_body.wrapper.default_http_code)] = {
46
             [int(description.output_body.wrapper.default_http_code)] = {
42
                 'description': str(int(description.output_body.wrapper.default_http_code)),  # nopep8
47
                 'description': str(int(description.output_body.wrapper.default_http_code)),  # nopep8
72
     # jsonschema based
77
     # jsonschema based
73
     if description.input_path:
78
     if description.input_path:
74
         schema_class = spec.schema_class_resolver(
79
         schema_class = spec.schema_class_resolver(
75
-            description.input_path.wrapper.processor.schema)
80
+            spec,
81
+            description.input_path.wrapper.processor.schema
82
+        )
76
         # TODO: look schema2parameters ?
83
         # TODO: look schema2parameters ?
77
         jsonschema = schema2jsonschema(schema_class, spec=spec)
84
         jsonschema = schema2jsonschema(schema_class, spec=spec)
78
         for name, schema in jsonschema.get('properties', {}).items():
85
         for name, schema in jsonschema.get('properties', {}).items():
85
 
92
 
86
     if description.input_query:
93
     if description.input_query:
87
         schema_class = spec.schema_class_resolver(
94
         schema_class = spec.schema_class_resolver(
88
-            description.input_query.wrapper.processor.schema)
95
+            spec,
96
+            description.input_query.wrapper.processor.schema
97
+        )
89
         jsonschema = schema2jsonschema(schema_class, spec=spec)
98
         jsonschema = schema2jsonschema(schema_class, spec=spec)
90
         for name, schema in jsonschema.get('properties', {}).items():
99
         for name, schema in jsonschema.get('properties', {}).items():
91
             method_operations.setdefault('parameters', []).append({
100
             method_operations.setdefault('parameters', []).append({
150
 
159
 
151
             if description.input_body:
160
             if description.input_body:
152
                 schemas.append(spec.schema_class_resolver(
161
                 schemas.append(spec.schema_class_resolver(
162
+                    spec,
153
                     description.input_body.wrapper.processor.schema
163
                     description.input_body.wrapper.processor.schema
154
                 ))
164
                 ))
155
 
165
 
156
             if description.input_forms:
166
             if description.input_forms:
157
                 schemas.append(spec.schema_class_resolver(
167
                 schemas.append(spec.schema_class_resolver(
168
+                    spec,
158
                     description.input_forms.wrapper.processor.schema
169
                     description.input_forms.wrapper.processor.schema
159
                 ))
170
                 ))
160
 
171
 
161
             if description.output_body:
172
             if description.output_body:
162
                 schemas.append(spec.schema_class_resolver(
173
                 schemas.append(spec.schema_class_resolver(
174
+                    spec,
163
                     description.output_body.wrapper.processor.schema
175
                     description.output_body.wrapper.processor.schema
164
                 ))
176
                 ))
165
 
177
 
168
                     schemas.append(type(error.wrapper.error_builder))
180
                     schemas.append(type(error.wrapper.error_builder))
169
 
181
 
170
         for schema in set(schemas):
182
         for schema in set(schemas):
171
-            spec.definition(spec.schema_name_resolver(schema), schema=schema)
183
+            spec.definition(
184
+                spec.schema_name_resolver(schema),
185
+                schema=schema
186
+            )
172
 
187
 
173
         # add views
188
         # add views
174
         # with app.test_request_context():
189
         # with app.test_request_context():