diff --git a/lib/core/swagger.py b/lib/core/swagger.py index 3f0f2e587..700df9b89 100644 --- a/lib/core/swagger.py +++ b/lib/core/swagger.py @@ -29,8 +29,15 @@ class Operation: return list(filter(lambda p: (p["in"] in types), self.parameters())) def bodyRef(self): + # OpenAPI v3 if "requestBody" in self.props: return self.props["requestBody"]["content"]["application/json"]["schema"]["$ref"] + # swagger v2 + elif "parameters" in self.props: + inParameters = self.parametersForTypes(["body"]) + if not isinstance(inParameters, list) or len(inParameters) < 1: + return None + return inParameters[0]["schema"]["$ref"] return None # header injection is not currently supported