Skip to content

Commit 5450222

Browse files
committed
remove duplicated title
1 parent 4a66a88 commit 5450222

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

vetiver/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ async def get_prototype():
129129
"model_json_schema",
130130
self.model.prototype.schema_json,
131131
)()
132-
# pydantic<2 returns a string, need to handle that
132+
# pydantic<2 returns a string, need to handle to json format
133133
if isinstance(prototype_schema, str):
134134
prototype_schema = json.loads(prototype_schema)
135+
for key, value in prototype_schema["properties"].items():
136+
value.pop("title", None)
135137
return prototype_schema
136138

137139
self.vetiver_post(

vetiver/tests/test_server.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def test_get_prototype(client):
8181
assert response.status_code == 200, response.text
8282
assert response.json() == {
8383
"properties": {
84-
"B": {"default": 55, "title": "B", "type": "integer"},
85-
"C": {"default": 65, "title": "C", "type": "integer"},
86-
"D": {"default": 17, "title": "D", "type": "integer"},
84+
"B": {"default": 55, "type": "integer"},
85+
"C": {"default": 65, "type": "integer"},
86+
"D": {"default": 17, "type": "integer"},
8787
},
8888
"title": "prototype",
8989
"type": "object",
@@ -95,9 +95,9 @@ def test_complex_prototype(complex_prototype_model):
9595
assert response.status_code == 200, response.text
9696
assert response.json() == {
9797
"properties": {
98-
"B": {"exclusiveMinimum": 42, "title": "B", "type": "integer"},
99-
"C": {"exclusiveMinimum": 42, "title": "C", "type": "integer"},
100-
"D": {"exclusiveMinimum": 42, "title": "D", "type": "integer"},
98+
"B": {"exclusiveMinimum": 42, "type": "integer"},
99+
"C": {"exclusiveMinimum": 42, "type": "integer"},
100+
"D": {"exclusiveMinimum": 42, "type": "integer"},
101101
},
102102
"required": ["B", "C", "D"],
103103
"title": "CustomPrototype",

0 commit comments

Comments
 (0)