Skip to content

Commit

Permalink
fix schema regression
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeiczin committed Aug 30, 2024
1 parent f0b2603 commit c8af70f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/reliqua/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def __init__(self, code=None, description=None, content=None, schema=None):
self.code = code
self.description = description
self.content = content
print(f"RESPONSE ===> {content}")
self.schema = schema if schema else "default_response"

def __repr__(self):
Expand All @@ -250,7 +249,7 @@ def __repr__(self):
def dict(self):
"""Return dict of data."""
content_types = [CONTENT_MAP.get(x) for x in self.content]
schema = {"$ref": f"#/components/schemas/{self.schema}"}
schema = {"schema": {"$ref": f"#/components/schemas/{self.schema}"}}
content = {x: schema for x in content_types}

return {
Expand Down Expand Up @@ -299,12 +298,7 @@ def __init__(
self.tags = tags or []
self.callbacks = callbacks or {}
self.parameters = [Parameter(**x) for x in parameters or []]
print(">>>>>>>>>>>>>>>")
print(responses)
print(f"accepts: {accepts}")
print(f"return_types {return_types}")
self.responses = [Response(**x, content=return_types) for x in responses or []]
print("<<<<<<<<<<<<<<<")
self._accepts = accepts
self.request_body_parameters = {x.name: x.dict() for x in self.parameters if x.in_request_body()}

Expand Down Expand Up @@ -346,7 +340,7 @@ def body(self):
"""Return request body."""
accepts = [CONTENT_MAP.get(x) for x in self.accepts]
required = [k for k, v in self.request_body_parameters.items() if v.get("required") is True]
schema = {"type": "object", "required": required, "properties": self.request_body_parameters}
schema = {"schema": {"type": "object", "required": required, "properties": self.request_body_parameters}}
content = {x: schema for x in accepts}

return {
Expand Down

0 comments on commit c8af70f

Please sign in to comment.