get_pydantic_schema
Get the JSON Schema for a Pydantic BaseModel by providing its import path and optional project directory. Use it to generate TypeScript interfaces or validate data.
Instructions
Extract the JSON Schema from a local Pydantic BaseModel class definition.
Args: model_path: Import string pointing to the Pydantic model (e.g. 'models.user:UserCreate', 'src/schemas.py:Item'). project_dir: Optional path to the project root directory. Defaults to current working directory.
Returns: The JSON schema dictionary for the Pydantic model or an error dictionary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_path | Yes | ||
| project_dir | No |