@@ -78,6 +78,82 @@ def create_mock_version(version_overrides=None, version_id="xyz123"):
78
78
"required" : ["prompt" ],
79
79
},
80
80
"Output" : {"type" : "string" , "title" : "Output" },
81
+ "PredictionResponse" : {
82
+ "type" : "object" ,
83
+ "title" : "PredictionResponse" ,
84
+ "properties" : {
85
+ "id" : {"type" : "string" , "title" : "Id" },
86
+ "logs" : {"type" : "string" , "title" : "Logs" , "default" : "" },
87
+ "error" : {"type" : "string" , "title" : "Error" },
88
+ "input" : {"$ref" : "#/components/schemas/Input" },
89
+ "output" : {"$ref" : "#/components/schemas/Output" },
90
+ "status" : {"$ref" : "#/components/schemas/Status" },
91
+ "metrics" : {"type" : "object" , "title" : "Metrics" },
92
+ "version" : {"type" : "string" , "title" : "Version" },
93
+ "created_at" : {
94
+ "type" : "string" ,
95
+ "title" : "Created At" ,
96
+ "format" : "date-time" ,
97
+ },
98
+ "started_at" : {
99
+ "type" : "string" ,
100
+ "title" : "Started At" ,
101
+ "format" : "date-time" ,
102
+ },
103
+ "completed_at" : {
104
+ "type" : "string" ,
105
+ "title" : "Completed At" ,
106
+ "format" : "date-time" ,
107
+ },
108
+ },
109
+ },
110
+ "PredictionRequest" : {
111
+ "type" : "object" ,
112
+ "title" : "PredictionRequest" ,
113
+ "properties" : {
114
+ "id" : {"type" : "string" , "title" : "Id" },
115
+ "input" : {"$ref" : "#/components/schemas/Input" },
116
+ "webhook" : {
117
+ "type" : "string" ,
118
+ "title" : "Webhook" ,
119
+ "format" : "uri" ,
120
+ "maxLength" : 65536 ,
121
+ "minLength" : 1 ,
122
+ },
123
+ "created_at" : {
124
+ "type" : "string" ,
125
+ "title" : "Created At" ,
126
+ "format" : "date-time" ,
127
+ },
128
+ "output_file_prefix" : {
129
+ "type" : "string" ,
130
+ "title" : "Output File Prefix" ,
131
+ },
132
+ "webhook_events_filter" : {
133
+ "type" : "array" ,
134
+ "items" : {"$ref" : "#/components/schemas/WebhookEvent" },
135
+ "default" : ["start" , "output" , "logs" , "completed" ],
136
+ },
137
+ },
138
+ },
139
+ "Status" : {
140
+ "enum" : [
141
+ "starting" ,
142
+ "processing" ,
143
+ "succeeded" ,
144
+ "canceled" ,
145
+ "failed" ,
146
+ ],
147
+ "type" : "string" ,
148
+ "title" : "Status" ,
149
+ "description" : "An enumeration." ,
150
+ },
151
+ "WebhookEvent" : {
152
+ "enum" : ["start" , "output" , "logs" , "completed" ],
153
+ "type" : "string" ,
154
+ "title" : "WebhookEvent" ,
155
+ "description" : "An enumeration." ,
156
+ },
81
157
}
82
158
},
83
159
},
@@ -345,6 +421,7 @@ async def test_use_function_openapi_schema_dereferenced(client_mode):
345
421
"openapi_schema" : {
346
422
"components" : {
347
423
"schemas" : {
424
+ "Extra" : {"type" : "object" },
348
425
"Output" : {"$ref" : "#/components/schemas/ModelOutput" },
349
426
"ModelOutput" : {
350
427
"type" : "object" ,
@@ -374,6 +451,12 @@ async def test_use_function_openapi_schema_dereferenced(client_mode):
374
451
else :
375
452
schema = hotdog_detector .openapi_schema ()
376
453
454
+ assert schema ["components" ]["schemas" ]["Extra" ] == {"type" : "object" }
455
+ assert schema ["components" ]["schemas" ]["Input" ] == {
456
+ "type" : "object" ,
457
+ "properties" : {"prompt" : {"type" : "string" , "title" : "Prompt" }},
458
+ "required" : ["prompt" ],
459
+ }
377
460
assert schema ["components" ]["schemas" ]["Output" ] == {
378
461
"type" : "object" ,
379
462
"properties" : {
@@ -386,7 +469,14 @@ async def test_use_function_openapi_schema_dereferenced(client_mode):
386
469
},
387
470
}
388
471
472
+ # Assert everything else is stripped out
473
+ assert schema ["paths" ] == {}
474
+
475
+ assert "PredictionRequest" not in schema ["components" ]["schemas" ]
476
+ assert "PredictionResponse" not in schema ["components" ]["schemas" ]
389
477
assert "ModelOutput" not in schema ["components" ]["schemas" ]
478
+ assert "Status" not in schema ["components" ]["schemas" ]
479
+ assert "WebhookEvent" not in schema ["components" ]["schemas" ]
390
480
391
481
392
482
@pytest .mark .asyncio
0 commit comments