Skip to content

Commit

Permalink
fix: __root__ properties (#255)
Browse files Browse the repository at this point in the history
* fix: __root__ properties

Signed-off-by: Keming <[email protected]>

* add test for __root__

Signed-off-by: Keming <[email protected]>

* release 1.0.0a1

Signed-off-by: Keming <[email protected]>

Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy committed Aug 24, 2022
1 parent 51dda8f commit 52f0972
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="spectree",
version="1.0.0a0",
version="1.0.0a1",
license="Apache-2.0",
author="Keming Yang",
author_email="[email protected]",
Expand Down
3 changes: 2 additions & 1 deletion spectree/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def parse_params(
for attr in attr_to_spec_key:
if hasattr(func, attr):
model = models[getattr(func, attr)]
for name, schema in model["properties"].items():
properties = model.get("properties", {model.get("title"): model})
for name, schema in properties.items():
# Route parameters keywords taken out of schema level
extra = {
kw: schema.pop(kw) for kw in route_param_keywords if kw in schema
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_falcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def on_get(self, req, resp):
pass

@api.validate(
json=JSON, # resp is missing completely
json=StrDict, # resp is missing completely
)
def on_post(self, req, resp, json: JSON):
pass
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_falcon_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async def on_get(self, req, resp):
pass

@api.validate(
json=JSON, # resp is missing completely
json=StrDict, # resp is missing completely
)
async def on_post(self, req, resp, json: JSON):
pass
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def user_address(name, address_id):

@app.route("/api/no_response", methods=["GET", "POST"])
@api.validate(
json=JSON,
json=StrDict,
)
def no_response():
return {}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_flask_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def user_address(name, address_id):

@app.route("/api/no_response", methods=["GET", "POST"])
@api.validate(
json=JSON,
json=StrDict,
)
def no_response():
return {}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_flask_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get(self):
return {}

@api.validate(
json=JSON, # resp is missing completely
json=StrDict, # resp is missing completely
)
def post(self, json: JSON):
return {}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def user_score_model(request):


@api.validate(
json=JSON,
json=StrDict,
resp=Response(HTTP_200=None),
)
async def no_response(request):
Expand Down

0 comments on commit 52f0972

Please sign in to comment.