Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.6.3 #111

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project(zswag)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(ZSWAG_VERSION 1.6.1)
set(ZSWAG_VERSION 1.6.3)

option(ZSWAG_BUILD_WHEELS "Enable zswag whl-output to WHEEL_DEPLOY_DIRECTORY." ON)
option(ZSWAG_KEYCHAIN_SUPPORT "Enable zswag keychain support." ON)
Expand Down Expand Up @@ -118,7 +118,7 @@ if(ZSWAG_BUILD_WHEELS AND NOT TARGET pybind11)
endif()

if (NOT TARGET zserio-cmake-helper)
set(ZSERIO_VERSION "2.11.0")
set(ZSERIO_VERSION "2.12.0")
FetchContent_Declare(zserio-cmake-helper
GIT_REPOSITORY "https://github.com/Klebert-Engineering/zserio-cmake-helper.git"
GIT_TAG "main"
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ server class with a user-written app controller and a fitting OpenAPI specificat
It is based on [Flask](https://flask.palletsprojects.com/en/1.1.x/) and
[Connexion](https://connexion.readthedocs.io/en/latest/).

**Implementation choice regarding HTTP response codes:** The server as implemented
here will return HTTP code `400` (Bad Request) when the user request could not
be parsed, and `500` (Internal Server Error) when a different exception occurred while
generating the response/running the user's controller implementation.

### Integration Example

We consider the same `myapp` directory with a `services.zs` zserio file
Expand Down
8 changes: 7 additions & 1 deletion libs/zswag/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ def wsgi_method(fun=zserio_modem_function, spec=method_spec, req_t=request_type,
spec=spec,
headers=flask_request.headers,
**kwargs)
return bytes(fun(request_blob, None).byte_array)
try:
return bytes(fun(request_blob, None).byte_array)
except zserio.PythonRuntimeException as e:
if str(e).startswith("BitStreamReader"):
josephbirkner marked this conversation as resolved.
Show resolved Hide resolved
return "Error in BitStreamReader: Could not parse malformed request.", 400
else:
return f"Internal Server Error: {e}", 500
setattr(self.service_instance, method_name, wsgi_method)

def method_impl(request, ctx=None, fun=user_function):
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
connexion
connexion~=2.14.2
requests
zserio>=2.4.2
zserio<3.0.0
pyyaml
pyzswagcl>=1.6.1
pyzswagcl==1.6.3
openapi-spec-validator
Loading