| 1 | import datetime |
| 2 | from ninja import Schema, Path |
| 3 | |
| 4 | |
| 5 | class PathDate(Schema): |
| 6 | year: int |
| 7 | month: int |
| 8 | day: int |
| 9 | |
| 10 | def value(self): |
| 11 | return datetime.date(self.year, self.month, self.day) |
| 12 | |
| 13 | |
| 14 | @api.get("/events/{year}/{month}/{day}") |
| 15 | def events(request, date: Path[PathDate]): |
| 16 | return {"date": date.value()} |