File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
packages/models-library/src/models_library/utils Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 55
66See how is used to validate input/output content-schemas of service models
77"""
8+
89# SEE possible enhancements in https://github.com/ITISFoundation/osparc-simcore/issues/3008
910
1011
1314from copy import deepcopy
1415from typing import Any
1516
17+ import jsonref
1618import jsonschema
1719from jsonschema import validators
20+ from pydantic .json_schema import GenerateJsonSchema , JsonSchemaMode , JsonSchemaValue
21+ from pydantic_core import CoreSchema
1822
1923# ERRORS
2024
@@ -92,6 +96,13 @@ def any_ref_key(obj):
9296 return False
9397
9498
99+ class ResolvedGenerateJsonSchema (GenerateJsonSchema ):
100+ def generate (self , schema : CoreSchema , mode : JsonSchemaMode ) -> JsonSchemaValue :
101+ schema_value = super ().generate (schema = schema , mode = mode )
102+ schema_value = jsonref .replace_refs (schema_value )
103+ return JsonSchemaValue (schema_value )
104+
105+
95106__all__ : tuple [str , ...] = (
96107 "any_ref_key" ,
97108 "InvalidJsonSchema" ,
You can’t perform that action at this time.
0 commit comments