Skip to content

Commit

Permalink
Merge pull request #111 from ndsev/release/1.6.3
Browse files Browse the repository at this point in the history
Release 1.6.3
  • Loading branch information
josephbirkner committed Dec 1, 2023
2 parents 9a0380f + 32d8d16 commit f02a0d7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
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"):
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

0 comments on commit f02a0d7

Please sign in to comment.