schema_json_of
Generate a JSON schema (as JSON) for the passed model or dynamically generated one.
def schema_json_of(
type_: Any,
title: NameFactory | None = None,
by_alias: bool = True,
ref_template: string = DEFAULT_REF_TEMPLATE,
schema_generator: type[GenerateJsonSchema] = GenerateJsonSchema,
**dumps_kwargs: Any
) - > string
Generate a JSON schema (as JSON) for the passed model or dynamically generated one.
Parameters
| Name | Type | Description |
|---|---|---|
| type_ | Any | The Python type or Pydantic model for which the JSON schema is generated. |
| title | `NameFactory | None` = None |
| by_alias | bool = True | Whether to use the field's alias as the key in the JSON schema if one is defined. |
| ref_template | string = DEFAULT_REF_TEMPLATE | The format string used for generating internal JSON schema references. |
| schema_generator | type[GenerateJsonSchema] = GenerateJsonSchema | The class used to customize the logic for generating the JSON schema. |
| **dumps_kwargs | Any | Additional keyword arguments passed directly to the underlying json.dumps call. |
Returns
| Type | Description |
|---|---|
string | A JSON-formatted string representing the JSON schema of the provided type. |