Skip to content

Commit

Permalink
Merge pull request #44 from 0b01001001/dev
Browse files Browse the repository at this point in the history
Dev: change actions trigger condition, fix starlette json decode response
  • Loading branch information
kemingy authored Mar 18, 2020
2 parents ed0c520 + 9bcd315 commit acdf875
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
43 changes: 23 additions & 20 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Python package

on: [push]
on:
pull_request:
branches:
- master
push:

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
max-parallel: 3
Expand All @@ -13,21 +16,21 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
make style
- name: Test with pytest
run: |
pip install pytest
pip install flask falcon starlette[full]
make test
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
make style
- name: Test with pytest
run: |
pip install pytest
pip install flask falcon starlette[full]
make test
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='0.3.2',
version='0.3.3',
author='Keming Yang',
author_email='kemingy94@gmail.com',
description=('generate OpenAPI document and validate request&response '
Expand Down
5 changes: 2 additions & 3 deletions spectree/plugins/starlette_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ async def validate(self, func, query, json, headers, cookies, resp, *args, **kwa
'spectree_validation': err.errors(),
},
)
response = JSONResponse(err.errors(), 422)
return response
return JSONResponse(err.errors(), 422)
except JSONDecodeError as err:
self.logger.info(
'422 Validation Error',
extra={
'spectree_validation': str(err),
}
)
response = JSONResponse({'error_msg': str(err)}, 422)
return JSONResponse({'error_msg': str(err)}, 422)
except Exception:
raise

Expand Down

0 comments on commit acdf875

Please sign in to comment.