@aws/nx-plugin 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE-THIRD-PARTY
CHANGED
|
@@ -3190,7 +3190,7 @@ THE SOFTWARE.
|
|
|
3190
3190
|
|
|
3191
3191
|
---
|
|
3192
3192
|
|
|
3193
|
-
The following software may be included in this product: @hey-api/json-schema-ref-parser (1.0.
|
|
3193
|
+
The following software may be included in this product: @hey-api/json-schema-ref-parser (1.0.3)
|
|
3194
3194
|
This software contains the following license and notice below:
|
|
3195
3195
|
|
|
3196
3196
|
MIT License
|
|
@@ -3217,7 +3217,7 @@ SOFTWARE.
|
|
|
3217
3217
|
|
|
3218
3218
|
---
|
|
3219
3219
|
|
|
3220
|
-
The following software may be included in this product: @hey-api/openapi-ts (0.64.
|
|
3220
|
+
The following software may be included in this product: @hey-api/openapi-ts (0.64.13)
|
|
3221
3221
|
This software contains the following license and notice below:
|
|
3222
3222
|
|
|
3223
3223
|
MIT License
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ from fastapi.openapi.utils import get_openapi
|
|
|
15
15
|
from fastapi.responses import JSONResponse
|
|
16
16
|
from fastapi.routing import APIRoute
|
|
17
17
|
from mangum import Mangum
|
|
18
|
+
from pydantic import BaseModel
|
|
18
19
|
from starlette.middleware.exceptions import ExceptionMiddleware
|
|
19
20
|
|
|
20
21
|
os.environ["POWERTOOLS_METRICS_NAMESPACE"] = "TestApi"
|
|
@@ -24,8 +25,14 @@ logger: Logger = Logger()
|
|
|
24
25
|
metrics: Metrics = Metrics()
|
|
25
26
|
tracer: Tracer = Tracer()
|
|
26
27
|
|
|
28
|
+
class InternalServerErrorDetails(BaseModel):
|
|
29
|
+
detail: str
|
|
30
|
+
|
|
27
31
|
app = FastAPI(
|
|
28
|
-
title="TestApi"
|
|
32
|
+
title="TestApi",
|
|
33
|
+
responses={
|
|
34
|
+
500: {"model": InternalServerErrorDetails}
|
|
35
|
+
}
|
|
29
36
|
)
|
|
30
37
|
lambda_handler = Mangum(app)
|
|
31
38
|
|
|
@@ -46,7 +53,9 @@ async def unhandled_exception_handler(request, err):
|
|
|
46
53
|
|
|
47
54
|
metrics.add_metric(name="Failure", unit=MetricUnit.Count, value=1)
|
|
48
55
|
|
|
49
|
-
return JSONResponse(status_code=500,
|
|
56
|
+
return JSONResponse(status_code=500,
|
|
57
|
+
content=InternalServerErrorDetails(
|
|
58
|
+
detail="Internal Server Error").model_dump())
|
|
50
59
|
|
|
51
60
|
@app.middleware("http")
|
|
52
61
|
async def metrics_handler(request: Request, call_next):
|
|
@@ -119,14 +128,20 @@ def custom_openapi():
|
|
|
119
128
|
|
|
120
129
|
app.openapi = custom_openapi
|
|
121
130
|
",
|
|
122
|
-
"apps/test_api/test_api/main.py": "from
|
|
131
|
+
"apps/test_api/test_api/main.py": "from pydantic import BaseModel
|
|
132
|
+
|
|
133
|
+
from .init import app, lambda_handler, tracer
|
|
123
134
|
|
|
124
135
|
handler = lambda_handler
|
|
125
136
|
|
|
126
|
-
|
|
137
|
+
class EchoOutput(BaseModel):
|
|
138
|
+
message: str
|
|
139
|
+
|
|
140
|
+
@app.get("/echo")
|
|
127
141
|
@tracer.capture_method
|
|
128
|
-
def
|
|
129
|
-
return {
|
|
142
|
+
def echo(message: str) -> EchoOutput:
|
|
143
|
+
return EchoOutput(message=f"{message}")
|
|
144
|
+
",
|
|
130
145
|
"apps/test_api/tests/__init__.py": """"unit tests."""
|
|
131
146
|
",
|
|
132
147
|
"apps/test_api/tests/conftest.py": """"Unit tests configuration module."""
|
|
@@ -9,6 +9,7 @@ from fastapi.openapi.utils import get_openapi
|
|
|
9
9
|
from fastapi.responses import JSONResponse
|
|
10
10
|
from fastapi.routing import APIRoute
|
|
11
11
|
from mangum import Mangum
|
|
12
|
+
from pydantic import BaseModel
|
|
12
13
|
from starlette.middleware.exceptions import ExceptionMiddleware
|
|
13
14
|
|
|
14
15
|
os.environ["POWERTOOLS_METRICS_NAMESPACE"] = "<%= apiNameClassName %>"
|
|
@@ -18,8 +19,14 @@ logger: Logger = Logger()
|
|
|
18
19
|
metrics: Metrics = Metrics()
|
|
19
20
|
tracer: Tracer = Tracer()
|
|
20
21
|
|
|
22
|
+
class InternalServerErrorDetails(BaseModel):
|
|
23
|
+
detail: str
|
|
24
|
+
|
|
21
25
|
app = FastAPI(
|
|
22
|
-
title="<%= apiNameClassName %>"
|
|
26
|
+
title="<%= apiNameClassName %>",
|
|
27
|
+
responses={
|
|
28
|
+
500: {"model": InternalServerErrorDetails}
|
|
29
|
+
}
|
|
23
30
|
)
|
|
24
31
|
lambda_handler = Mangum(app)
|
|
25
32
|
|
|
@@ -40,7 +47,9 @@ async def unhandled_exception_handler(request, err):
|
|
|
40
47
|
|
|
41
48
|
metrics.add_metric(name="Failure", unit=MetricUnit.Count, value=1)
|
|
42
49
|
|
|
43
|
-
return JSONResponse(status_code=500,
|
|
50
|
+
return JSONResponse(status_code=500,
|
|
51
|
+
content=InternalServerErrorDetails(
|
|
52
|
+
detail="Internal Server Error").model_dump())
|
|
44
53
|
|
|
45
54
|
@app.middleware("http")
|
|
46
55
|
async def metrics_handler(request: Request, call_next):
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
|
|
1
3
|
from .init import app, lambda_handler, tracer
|
|
2
4
|
|
|
3
5
|
handler = lambda_handler
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
class EchoOutput(BaseModel):
|
|
8
|
+
message: str
|
|
9
|
+
|
|
10
|
+
@app.get("/echo")
|
|
6
11
|
@tracer.capture_method
|
|
7
|
-
def
|
|
8
|
-
return {"
|
|
12
|
+
def echo(message: str) -> EchoOutput:
|
|
13
|
+
return EchoOutput(message=f"{message}")
|