Skip to content

Commit aa613f3

Browse files
committed
[UNSTABLE] [Dependencies] Apply changes required by the upgrade of Connexion to version 3.1.x.
Signed-off-by: Giacomo Marciani <[email protected]>
1 parent 05f3d74 commit aa613f3

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

cli/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ aws-cdk.core~=1.164
1616
aws_cdk.aws-cloudwatch~=1.164
1717
aws_cdk.aws-lambda~=1.164
1818
boto3>=1.16.14
19-
connexion~=3.1
19+
connexion~=3.1.0
2020
flask>=2.2.5,<2.3
21+
a2wsgi~=1.10.7
2122
jinja2~=3.0
2223
jmespath~=0.10
2324
jsii==1.85.0

cli/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def readme():
4949
"werkzeug==3.1.3",
5050
"connexion~=3.1",
5151
"flask>=2.2.5,<2.3",
52+
"a2wsgi~=1.10.7",
5253
"jmespath~=0.10",
5354
"jsii==1.85.0",
5455
]

cli/src/pcluster/api/encoder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
import datetime
1212

1313
import six
14-
from connexion.apps.flask_app import FlaskJSONEncoder
14+
from connexion.apps.flask import Jsonifier
1515

1616
from pcluster.api.models.base_model_ import Model
1717
from pcluster.utils import to_iso_timestr
1818

1919

20-
class JSONEncoder(FlaskJSONEncoder):
20+
class JSONEncoder(Jsonifier):
2121
"""Make the model objects JSON serializable."""
2222

2323
include_nulls = False
@@ -34,5 +34,6 @@ def default(self, obj): # pylint: disable=arguments-renamed
3434
dikt[attr] = value
3535
return dikt
3636
elif isinstance(obj, datetime.date):
37+
# FIXME Expected type 'datetime', got 'date' instead. This issue exists before the upgrade from Connexion 2 to Connexion 3
3738
return to_iso_timestr(obj)
38-
return FlaskJSONEncoder.default(self, obj)
39+
return Jsonifier.default(self, obj)

cli/src/pcluster/api/flask_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import connexion
1212
from connexion import ProblemException
13-
from connexion.decorators.validation import ParameterValidator
13+
from connexion.validators.parameter import ParameterValidator
1414
from flask import Response, jsonify, request
1515
from werkzeug.exceptions import HTTPException
1616

@@ -74,7 +74,7 @@ def __init__(self, swagger_ui: bool = False, validate_responses=False):
7474
assert_valid_node_js()
7575
options = {"swagger_ui": swagger_ui}
7676

77-
self.app = connexion.FlaskApp(__name__, specification_dir="openapi/", skip_error_handlers=True)
77+
self.app = connexion.FlaskApp(__name__, specification_dir="openapi/")
7878
self.flask_app = self.app.app
7979
self.flask_app.json_encoder = encoder.JSONEncoder
8080
self.app.add_api(

0 commit comments

Comments
 (0)