Skip to content

Commit d46821d

Browse files
committed
test-coverage: still more on test-coverate
1 parent 89513e9 commit d46821d

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

ellar/openapi/route_doc_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def get_openapi_operation_parameters(
262262
}
263263
if field_info.description:
264264
parameter["description"] = field_info.description
265-
if field_info.examples:
265+
if field_info.examples: # pragma:no cover
266266
parameter["examples"] = field_info.examples # type:ignore[assignment]
267267
if field_info.deprecated:
268268
parameter["deprecated"] = field_info.deprecated
@@ -297,7 +297,7 @@ def get_openapi_operation_request_body(
297297
request_body_oai["required"] = model_field.required
298298

299299
request_media_content: t.Dict[str, t.Any] = {"schema": body_schema}
300-
if field_info.examples:
300+
if field_info.examples: # pragma: no cover
301301
request_media_content["examples"] = field_info.examples
302302

303303
request_body_oai["content"] = {request_media_type: request_media_content}

tests/test_routing/test_body_union_schema.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from ellar.common import Body, post
55
from ellar.common.serializer import serialize_object
66
from ellar.core import Request
7-
from ellar.openapi import OpenAPIDocumentBuilder
7+
from ellar.openapi import OpenAPIDocumentBuilder, openapi_info
88
from ellar.testing import Test
99

1010
from .sample import Item, OtherItem, Product
@@ -25,7 +25,15 @@ def embed_qty(qty: Body[int, Body.P(12, embed=True)]):
2525

2626

2727
@post("/items/alias")
28-
def alias_qty(qty: Body[int, Body.P(embed=True, alias="aliasQty")]):
28+
@openapi_info(tags=["Product"], description="Modify Product Qty", deprecated=True)
29+
def alias_qty(
30+
qty: Body[
31+
int,
32+
Body.P(
33+
embed=True, alias="aliasQty", description="Product Qty", deprecated=True
34+
),
35+
],
36+
):
2937
return {"qty": qty}
3038

3139

@@ -78,6 +86,8 @@ def alias_qty(qty: Body[int, Body.P(embed=True, alias="aliasQty")]):
7886
},
7987
"/items/alias": {
8088
"post": {
89+
"tags": ["Product"],
90+
"description": "Modify Product Qty",
8191
"operationId": "alias_qty_items_alias_post",
8292
"requestBody": {
8393
"content": {
@@ -109,6 +119,7 @@ def alias_qty(qty: Body[int, Body.P(embed=True, alias="aliasQty")]):
109119
},
110120
},
111121
},
122+
"deprecated": True,
112123
}
113124
},
114125
"/items/embed": {
@@ -196,7 +207,13 @@ def alias_qty(qty: Body[int, Body.P(embed=True, alias="aliasQty")]):
196207
"title": "ValidationError",
197208
},
198209
"body_alias_qty_items_alias_post": {
199-
"properties": {"aliasQty": {"type": "integer", "title": "Aliasqty"}},
210+
"properties": {
211+
"aliasQty": {
212+
"type": "integer",
213+
"title": "Aliasqty",
214+
"description": "Product Qty",
215+
}
216+
},
200217
"type": "object",
201218
"required": ["aliasQty"],
202219
"title": "body_alias_qty_items_alias_post",

0 commit comments

Comments
 (0)