Can I generate nested models from XML?
Yes. Nested XML elements and repeated nodes are converted into structured models for the selected output language.
Generate Pydantic BaseModel classes from XML examples for FastAPI request and response validation, alias handling, and typed Python services.
<user>
<id>101</id>
<name>Ada Lovelace</name>
<active>true</active>
<roles>
<role>admin</role>
<role>editor</role>
</roles>
<profile>
<email>ada@example.com</email>
<score>9.8</score>
</profile>
</user>
from pydantic import BaseModel
from typing import List
class UserModel(BaseModel):
id: int
name: str
active: bool
roles: List[str]
Yes. Nested XML elements and repeated nodes are converted into structured models for the selected output language.
Yes. Use the Force Optional toggle in the app toolbar when you need optional fields in the generated output.
Yes. Pydantic models generated from JSON can be used as request and response models in FastAPI endpoints.