instance_id
string | patch
string | repo
string | base_commit
string | hints_text
string | test_patch
string | problem_statement
string | version
string | FAIL_TO_PASS
sequence | PASS_TO_PASS
sequence | created_at
string |
---|---|---|---|---|---|---|---|---|---|---|
0b01001001__spectree-64 | diff --git a/setup.py b/setup.py
index 1b3cb64..4ef21e6 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
setup(
name='spectree',
- version='0.3.7',
+ version='0.3.8',
author='Keming Yang',
author_email='[email protected]',
description=('generate OpenAPI document and validate request&response '
diff --git a/spectree/utils.py b/spectree/utils.py
index bb5698d..73d6c71 100644
--- a/spectree/utils.py
+++ b/spectree/utils.py
@@ -54,6 +54,7 @@ def parse_params(func, params, models):
'in': 'query',
'schema': schema,
'required': name in query.get('required', []),
+ 'description': schema.get('description', ''),
})
if hasattr(func, 'headers'):
@@ -64,6 +65,7 @@ def parse_params(func, params, models):
'in': 'header',
'schema': schema,
'required': name in headers.get('required', []),
+ 'description': schema.get('description', ''),
})
if hasattr(func, 'cookies'):
@@ -74,6 +76,7 @@ def parse_params(func, params, models):
'in': 'cookie',
'schema': schema,
'required': name in cookies.get('required', []),
+ 'description': schema.get('description', ''),
})
return params
| 0b01001001/spectree | a091fab020ac26548250c907bae0855273a98778 | diff --git a/tests/common.py b/tests/common.py
index 0f2d696..83b4140 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -1,7 +1,7 @@
from enum import IntEnum, Enum
from typing import List
-from pydantic import BaseModel, root_validator
+from pydantic import BaseModel, root_validator, Field
class Order(IntEnum):
@@ -43,7 +43,7 @@ class Cookies(BaseModel):
class DemoModel(BaseModel):
uid: int
limit: int
- name: str
+ name: str = Field(..., description='user name')
def get_paths(spec):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index bf3426d..53dd3e1 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -98,8 +98,10 @@ def test_parse_params():
'name': 'uid',
'in': 'query',
'required': True,
+ 'description': '',
'schema': {
'title': 'Uid',
'type': 'integer',
}
}
+ assert params[2]['description'] == 'user name'
| [BUG]description for query paramters can not show in swagger ui
Hi, when I add a description for a schema used in query, it can not show in swagger ui but can show in Redoc
```py
@HELLO.route('/', methods=['GET'])
@api.validate(query=HelloForm)
def hello():
"""
hello 注释
:return:
"""
return 'ok'
class HelloForm(BaseModel):
"""
hello表单
"""
user: str # 用户名称
msg: str = Field(description='msg test', example='aa')
index: int
data: HelloGetListForm
list: List[HelloListForm]
```


| 0.0 | [
"tests/test_utils.py::test_parse_params"
] | [
"tests/test_utils.py::test_comments",
"tests/test_utils.py::test_parse_code",
"tests/test_utils.py::test_parse_name",
"tests/test_utils.py::test_has_model",
"tests/test_utils.py::test_parse_resp",
"tests/test_utils.py::test_parse_request"
] | 2020-10-12 13:21:50+00:00 |
No dataset card yet
- Downloads last month
- 48