File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,15 @@ def _traverse(obj: Any) -> None:
171
171
172
172
173
173
def _construct_ref_obj (pydantic_schema : PydanticSchema [PydanticType ]) -> Reference :
174
+ """
175
+ Construct a reference object from the Pydantic schema name
176
+
177
+ characters in the schema name that are invalid/problematic
178
+ for JSONschema $ref names will get replaced with underscores.
179
+ Especially needed for Pydantic generic Models with brackets "[]"
180
+
181
+ see: https://github.com/pydantic/pydantic/blob/aee6057378ccfec02126bf9c984a9b6d6b411777/pydantic/json_schema.py#L2031
182
+ """
174
183
ref_name = re .sub (
175
184
r"[^a-zA-Z0-9.\-_]" , "_" , pydantic_schema .schema_class .__name__
176
185
).replace ("." , "__" )
Original file line number Diff line number Diff line change @@ -243,6 +243,15 @@ def _traverse(obj: Any) -> None:
243
243
244
244
245
245
def _construct_ref_obj (pydantic_schema : PydanticSchema [PydanticType ]) -> Reference :
246
+ """
247
+ Construct a reference object from the Pydantic schema name
248
+
249
+ characters in the schema name that are invalid/problematic
250
+ for JSONschema $ref names will get replaced with underscores.
251
+ Especially needed for Pydantic generic Models with brackets "[]"
252
+
253
+ see: https://github.com/pydantic/pydantic/blob/aee6057378ccfec02126bf9c984a9b6d6b411777/pydantic/json_schema.py#L2031
254
+ """
246
255
ref_name = re .sub (
247
256
r"[^a-zA-Z0-9.\-_]" , "_" , pydantic_schema .schema_class .__name__
248
257
).replace ("." , "__" )
You can’t perform that action at this time.
0 commit comments