File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed
packages/models-library/src/models_library/utils
services/api-server/tests/unit Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,10 @@ def any_ref_key(obj):
9696 return False
9797
9898
99- class ResolvedGenerateJsonSchema (GenerateJsonSchema ):
99+ class GenerateResolvedJsonSchema (GenerateJsonSchema ):
100100 def generate (self , schema : CoreSchema , mode : JsonSchemaMode ) -> JsonSchemaValue :
101101 schema_value = super ().generate (schema = schema , mode = mode )
102- schema_value = jsonref .replace_refs (schema_value )
102+ schema_value = jsonref .replace_refs (schema_value , jsonschema = True )
103103 return JsonSchemaValue (schema_value )
104104
105105
Original file line number Diff line number Diff line change 1111from httpx import AsyncClient , BasicAuth
1212from models_library .api_schemas_long_running_tasks .tasks import TaskGet , TaskStatus
1313from models_library .progress_bar import ProgressReport , ProgressStructuredMessage
14+ from models_library .utils .json_schema import GenerateResolvedJsonSchema
1415from pytest_mock import MockerFixture , MockType
1516from servicelib .celery .models import TaskState
1617from servicelib .celery .models import TaskStatus as CeleryTaskStatus
@@ -143,11 +144,9 @@ async def test_get_task_result(
143144 total = 1.0 ,
144145 unit = "Byte" ,
145146 message = ProgressStructuredMessage .model_validate (
146- {
147- "description" : "some description" ,
148- "current" : 12.2 ,
149- "total" : 123 ,
150- }
147+ ProgressStructuredMessage .model_json_schema (
148+ schema_generator = GenerateResolvedJsonSchema
149+ )["examples" ][0 ]
151150 ),
152151 ),
153152 ),
@@ -167,11 +166,9 @@ async def test_get_task_result(
167166 total = 1.0 ,
168167 unit = "Byte" ,
169168 message = ProgressStructuredMessage .model_validate (
170- {
171- "description" : "some description" ,
172- "current" : 12.2 ,
173- "total" : 123 ,
174- }
169+ ProgressStructuredMessage .model_json_schema (
170+ schema_generator = GenerateResolvedJsonSchema
171+ )["examples" ][0 ]
175172 ),
176173 ),
177174 ),
You can’t perform that action at this time.
0 commit comments