Skip to content

Commit acdf875

Browse files
authored
Merge pull request turner-townsend#44 from 0b01001001/dev
Dev: change actions trigger condition, fix starlette json decode response
2 parents ed0c520 + 9bcd315 commit acdf875

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed
Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: Python package
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
push:
48

59
jobs:
610
build:
7-
811
runs-on: ${{ matrix.os }}
912
strategy:
1013
max-parallel: 3
@@ -13,21 +16,21 @@ jobs:
1316
os: [ubuntu-latest]
1417

1518
steps:
16-
- uses: actions/checkout@v1
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v1
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install -r requirements.txt
25-
- name: Lint with flake8
26-
run: |
27-
pip install flake8
28-
make style
29-
- name: Test with pytest
30-
run: |
31-
pip install pytest
32-
pip install flask falcon starlette[full]
33-
make test
19+
- uses: actions/checkout@v1
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
- name: Lint with flake8
29+
run: |
30+
pip install flake8
31+
make style
32+
- name: Test with pytest
33+
run: |
34+
pip install pytest
35+
pip install flask falcon starlette[full]
36+
make test

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setup(
1616
name='spectree',
17-
version='0.3.2',
17+
version='0.3.3',
1818
author='Keming Yang',
1919
author_email='kemingy94@gmail.com',
2020
description=('generate OpenAPI document and validate request&response '

spectree/plugins/starlette_plugin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ async def validate(self, func, query, json, headers, cookies, resp, *args, **kwa
6363
'spectree_validation': err.errors(),
6464
},
6565
)
66-
response = JSONResponse(err.errors(), 422)
67-
return response
66+
return JSONResponse(err.errors(), 422)
6867
except JSONDecodeError as err:
6968
self.logger.info(
7069
'422 Validation Error',
7170
extra={
7271
'spectree_validation': str(err),
7372
}
7473
)
75-
response = JSONResponse({'error_msg': str(err)}, 422)
74+
return JSONResponse({'error_msg': str(err)}, 422)
7675
except Exception:
7776
raise
7877

0 commit comments

Comments
 (0)