Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
Create Pydantic request schemas with dict in dict

this question about request.

{
  number: 0,
  week:{
    #day of week (0-monday, etc)
    0:{
       # hours 0 - 00:00, 1 - 01:00, etc
       0: 1.5,
       1: 3.99
  }
}

How I can create Pydantic class for this request schema? I try this:

from typing import Dict


class CoefficientForHour(BaseModel):
    hour: int
    coefficient: float


class Week(BaseModel):
    week_day: int
    coefficients_for_hours: Dict[int, CoefficientForHour]


class OneCreateRequest(BaseModel):
    number: int
    week: Dict[int, Week]

but is incorrect

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!