Commit b0316ae4 authored by jtc42's avatar jtc42
Browse files

Fixed default response docs

parent 6d7921e8
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -21,11 +21,22 @@ def view2path(rule: str, view: Resource, spec: APISpec):

    return params

def view2operations(view: Resource, spec: APISpec):
def view2operations(view: Resource, spec: APISpec, populate_default: bool = True):
    ops = {}
    for method in Resource.methods:
        if hasattr(view, method):
            
            if populate_default:
                ops[method] = {
                    "responses": {
                        200: {
                            "description": "success"
                        }
                    }
                }
            else:
                ops[method] = {}
        
            if hasattr(getattr(view, method), "__apispec__"):
                ops[method] = doc2operation(getattr(view, method).__apispec__, spec)