MCPcopy
hub / github.com/ormar-orm/ormar / construct_schema_function

Function construct_schema_function

ormar/models/helpers/validation.py:189–204  ·  view source on GitHub ↗

Modifies model example and description if needed. Note that schema extra has to be a function, otherwise it's called to soon before all the relations are expanded. :return: callable that will be run by pydantic to modify the schema :rtype: Callable

()

Source from the content-addressed store, hash-verified

187
188
189def construct_schema_function() -> Callable:
190 """
191 Modifies model example and description if needed.
192
193 Note that schema extra has to be a function, otherwise it's called to soon
194 before all the relations are expanded.
195
196 :return: callable that will be run by pydantic to modify the schema
197 :rtype: Callable
198 """
199
200 def schema_extra(schema: dict[str, Any], model: type["Model"]) -> None:
201 overwrite_example_and_description(schema=schema, model=model)
202 overwrite_binary_format(schema=schema, model=model)
203
204 return staticmethod(schema_extra) # type: ignore
205
206
207def modify_schema_example(model: type["Model"]) -> None: # noqa CCR001

Callers 1

modify_schema_exampleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected