Skip to content

Commit b0d9244

Browse files
author
the-forest-tree
committed
fix: correct bad usage of ellipsis that cancelled Optional flag
1 parent d437350 commit b0d9244

1 file changed

Lines changed: 108 additions & 89 deletions

File tree

hrflow/hrflow/schemas.py

Lines changed: 108 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ class LocationFields(BaseModel):
2828

2929

3030
class Location(BaseModel):
31-
text: t.Optional[str] = Field(..., description="Location text address.")
31+
text: t.Optional[str] = Field(None, description="Location text address.")
3232
lat: t.Optional[float] = Field(
33-
..., description="Geocentric latitude of the Location."
33+
None, description="Geocentric latitude of the Location."
3434
)
3535
lng: t.Optional[float] = Field(
36-
..., description="Geocentric longitude of the Location."
36+
None, description="Geocentric longitude of the Location."
3737
)
3838
_fields: t.Optional[LocationFields] = Field(
39-
...,
39+
None,
4040
alias="fields",
4141
description="other location attributes like country, country_code etc",
4242
)
@@ -45,56 +45,58 @@ class Location(BaseModel):
4545
class GeneralEntitySchema(BaseModel):
4646
name: str = Field(..., description="Identification name of the Object")
4747
value: t.Optional[str] = Field(
48-
..., description="Value associated to the Object's name"
48+
None, description="Value associated to the Object's name"
4949
)
5050

5151

5252
class Skill(BaseModel):
5353
name: str = Field(..., description="Identification name of the skill")
54-
type: t.Optional[str] = Field(..., description="Type of the skill. hard or soft")
55-
value: t.Optional[str] = Field(..., description="Value associated to the skill")
54+
type: t.Optional[str] = Field(None, description="Type of the skill. hard or soft")
55+
value: t.Optional[str] = Field(None, description="Value associated to the skill")
5656

5757

5858
# Job
5959
class Section(BaseModel):
6060
name: t.Optional[str] = Field(
61-
...,
61+
None,
6262
description="Identification name of a Section of the Job. Example: culture",
6363
)
6464
title: t.Optional[str] = Field(
65-
..., description="Display Title of a Section. Example: Corporate Culture"
65+
None, description="Display Title of a Section. Example: Corporate Culture"
6666
)
6767
description: t.Optional[str] = Field(
68-
..., description="Text description of a Section: Example: Our values areNone"
68+
None, description="Text description of a Section: Example: Our values areNone"
6969
)
7070

7171

7272
class RangesFloat(BaseModel):
7373
name: t.Optional[str] = Field(
74-
...,
74+
None,
7575
description=(
7676
"Identification name of a Range of floats attached "
7777
"to the Job. Example: salary"
7878
),
7979
)
80-
value_min: t.Optional[float] = Field(..., description="Min value. Example: 500.")
81-
value_max: t.Optional[float] = Field(..., description="Max value. Example: 100.")
82-
unit: t.Optional[str] = Field(..., description="Unit of the value. Example: euros.")
80+
value_min: t.Optional[float] = Field(None, description="Min value. Example: 500.")
81+
value_max: t.Optional[float] = Field(None, description="Max value. Example: 100.")
82+
unit: t.Optional[str] = Field(
83+
None, description="Unit of the value. Example: euros."
84+
)
8385

8486

8587
class RangesDate(BaseModel):
8688
name: t.Optional[str] = Field(
87-
...,
89+
None,
8890
description=(
8991
"Identification name of a Range of dates attached"
9092
" to the Job. Example: availability."
9193
),
9294
)
9395
value_min: t.Optional[str] = Field(
94-
..., description="Min value in datetime ISO 8601, Example: 500."
96+
None, description="Min value in datetime ISO 8601, Example: 500."
9597
)
9698
value_max: t.Optional[str] = Field(
97-
..., description="Max value in datetime ISO 8601, Example: 1000"
99+
None, description="Max value in datetime ISO 8601, Example: 1000"
98100
)
99101

100102

@@ -111,59 +113,74 @@ class Board(BaseModel):
111113

112114

113115
class HrFlowJob(BaseModel):
114-
key: str = Field(..., description="Identification key of the Job.")
115-
reference: t.Optional[str] = Field(..., description="Custom identifier of the Job.")
116+
key: str = Field(None, description="Identification key of the Job.")
117+
reference: t.Optional[str] = Field(
118+
None, description="Custom identifier of the Job."
119+
)
116120
name: str = Field(..., description="Job title.")
117-
board_key: str
121+
board_key: str = Field(
122+
..., description="Identification key of the Board attached to the Job."
123+
)
118124
location: Location = Field(..., description="Job location object.")
119-
sections: t.List[Section] = Field(..., description="Job custom sections.")
120-
culture: t.Optional[str]
121-
benefits: t.Optional[str]
122-
responsibilities: t.Optional[str]
123-
requirements: t.Optional[str]
124-
interviews: t.Optional[str]
125-
url: t.Optional[str] = Field(..., description="Job post original URL.")
126-
summary: t.Optional[str] = Field(..., description="Brief summary of the Job.")
125+
sections: t.List[Section] = Field(None, description="Job custom sections.")
126+
culture: t.Optional[str] = Field(
127+
None, description="Describes the company's values, work environment, and ethos."
128+
)
129+
benefits: t.Optional[str] = Field(
130+
None, description="Lists the perks and advantages offered to employees."
131+
)
132+
responsibilities: t.Optional[str] = Field(
133+
None, description="Outlines the duties and tasks expected from the role."
134+
)
135+
requirements: t.Optional[str] = Field(
136+
None,
137+
description="Specifies the qualifications and skills needed for the position.",
138+
)
139+
interviews: t.Optional[str] = Field(
140+
None, description="Provides information about the interview process and stages."
141+
)
142+
url: t.Optional[str] = Field(None, description="Job post original URL.")
143+
summary: t.Optional[str] = Field(None, description="Brief summary of the Job.")
127144
board: Board
128145
archived_at: t.Optional[str] = Field(
129-
...,
146+
None,
130147
description=(
131148
"type: datetime ISO8601, Archive date of the Job. "
132149
"The value is null for unarchived Jobs."
133150
),
134151
)
135152
updated_at: str = Field(
136-
..., description="type: datetime ISO8601, Last update date of the Job."
153+
None, description="type: datetime ISO8601, Last update date of the Job."
137154
)
138155
created_at: t.Optional[str] = Field(
139-
..., description="type: datetime ISO8601, Creation date of the Job."
156+
None, description="type: datetime ISO8601, Creation date of the Job."
140157
)
141158
skills: t.Optional[t.List[Skill]] = Field(
142-
..., description="List of skills of the Job."
159+
None, description="List of skills of the Job."
143160
)
144161
languages: t.Optional[t.List[GeneralEntitySchema]] = Field(
145-
..., description="List of spoken languages of the Job"
162+
None, description="List of spoken languages of the Job"
146163
)
147164
certifications: t.Optional[t.List[GeneralEntitySchema]] = Field(
148-
..., description="List of certifications of the Job."
165+
None, description="List of certifications of the Job."
149166
)
150167
courses: t.Optional[t.List[GeneralEntitySchema]] = Field(
151-
..., description="List of courses of the Job"
168+
None, description="List of courses of the Job"
152169
)
153170
tasks: t.Optional[t.List[GeneralEntitySchema]] = Field(
154-
..., description="List of tasks of the Job"
171+
None, description="List of tasks of the Job"
155172
)
156173
tags: t.Optional[t.List[GeneralEntitySchema]] = Field(
157-
..., description="List of tags of the Job"
174+
None, description="List of tags of the Job"
158175
)
159176
metadatas: t.Optional[t.List[GeneralEntitySchema]] = Field(
160-
..., description="List of metadatas of the Job"
177+
None, description="List of metadatas of the Job"
161178
)
162179
ranges_float: t.Optional[t.List[RangesFloat]] = Field(
163-
..., description="List of ranges of floats"
180+
None, description="List of ranges of floats"
164181
)
165182
ranges_date: t.Optional[t.List[RangesDate]] = Field(
166-
..., description="List of ranges of dates"
183+
None, description="List of ranges of dates"
167184
)
168185

169186

@@ -181,79 +198,81 @@ class ProfileInfo(BaseModel):
181198
last_name: t.Optional[str]
182199
email: t.Optional[str]
183200
phone: t.Optional[str]
184-
date_birth: t.Optional[str] = Field(..., description="Profile date of birth")
185-
location: t.Optional[Location] = Field(..., description="Profile location object")
201+
date_birth: t.Optional[str] = Field(None, description="Profile date of birth")
202+
location: t.Optional[Location] = Field(None, description="Profile location object")
186203
urls: t.Optional[t.List[Url]] = Field(
187-
..., description="Profile social networks and URLs"
204+
None, description="Profile social networks and URLs"
188205
)
189-
picture: t.Optional[str] = Field(..., description="Profile picture url")
190-
gender: t.Optional[str] = Field(..., description="Profile gender")
191-
summary: t.Optional[str] = Field(..., description="Profile summary text")
206+
picture: t.Optional[str] = Field(None, description="Profile picture url")
207+
gender: t.Optional[str] = Field(None, description="Profile gender")
208+
summary: t.Optional[str] = Field(None, description="Profile summary text")
192209

193210

194211
class Experience(BaseModel):
195212
key: t.Optional[str] = Field(
196-
..., description="Identification key of the Experience."
213+
None, description="Identification key of the Experience."
214+
)
215+
company: t.Optional[str] = Field(
216+
None, description="Company name of the Experience."
197217
)
198-
company: t.Optional[str] = Field(..., description="Company name of the Experience.")
199-
logo: t.Optional[str] = Field(..., description="Logo of the Company.")
200-
title: t.Optional[str] = Field(..., description="Title of the Experience.")
218+
logo: t.Optional[str] = Field(None, description="Logo of the Company.")
219+
title: t.Optional[str] = Field(None, description="Title of the Experience.")
201220
description: t.Optional[str] = Field(
202-
..., description="Description of the Experience."
221+
None, description="Description of the Experience."
203222
)
204223
location: t.Optional[Location] = Field(
205-
..., description="Location object of the Experience."
224+
None, description="Location object of the Experience."
206225
)
207226
date_start: t.Optional[str] = Field(
208-
..., description="Start date of the experience. type: ('datetime ISO 8601')"
227+
None, description="Start date of the experience. type: ('datetime ISO 8601')"
209228
)
210229
date_end: t.Optional[str] = Field(
211-
..., description="End date of the experience. type: ('datetime ISO 8601')"
230+
None, description="End date of the experience. type: ('datetime ISO 8601')"
212231
)
213232
skills: t.Optional[t.List[Skill]] = Field(
214-
..., description="List of skills of the Experience."
233+
None, description="List of skills of the Experience."
215234
)
216235
certifications: t.Optional[t.List[GeneralEntitySchema]] = Field(
217-
..., description="List of certifications of the Experience."
236+
None, description="List of certifications of the Experience."
218237
)
219238
courses: t.Optional[t.List[GeneralEntitySchema]] = Field(
220-
..., description="List of courses of the Experience."
239+
None, description="List of courses of the Experience."
221240
)
222241
tasks: t.Optional[t.List[GeneralEntitySchema]] = Field(
223-
..., description="List of tasks of the Experience."
242+
None, description="List of tasks of the Experience."
224243
)
225244

226245

227246
class Education(BaseModel):
228247
key: t.Optional[str] = Field(
229-
..., description="Identification key of the Education."
248+
None, description="Identification key of the Education."
230249
)
231-
school: t.Optional[str] = Field(..., description="School name of the Education.")
232-
logo: t.Optional[str] = Field(..., description="Logo of the School.")
233-
title: t.Optional[str] = Field(..., description="Title of the Education.")
250+
school: t.Optional[str] = Field(None, description="School name of the Education.")
251+
logo: t.Optional[str] = Field(None, description="Logo of the School.")
252+
title: t.Optional[str] = Field(None, description="Title of the Education.")
234253
description: t.Optional[str] = Field(
235-
..., description="Description of the Education."
254+
None, description="Description of the Education."
236255
)
237256
location: t.Optional[Location] = Field(
238-
..., description="Location object of the Education."
257+
None, description="Location object of the Education."
239258
)
240259
date_start: t.Optional[str] = Field(
241-
..., description="Start date of the Education. type: ('datetime ISO 8601')"
260+
None, description="Start date of the Education. type: ('datetime ISO 8601')"
242261
)
243262
date_end: t.Optional[str] = Field(
244-
..., description="End date of the Education. type: ('datetime ISO 8601')"
263+
None, description="End date of the Education. type: ('datetime ISO 8601')"
245264
)
246265
skills: t.Optional[t.List[Skill]] = Field(
247-
..., description="List of skills of the Education."
266+
None, description="List of skills of the Education."
248267
)
249268
certifications: t.Optional[t.List[GeneralEntitySchema]] = Field(
250-
..., description="List of certifications of the Education."
269+
None, description="List of certifications of the Education."
251270
)
252271
courses: t.Optional[t.List[GeneralEntitySchema]] = Field(
253-
..., description="List of courses of the Education."
272+
None, description="List of courses of the Education."
254273
)
255274
tasks: t.Optional[t.List[GeneralEntitySchema]] = Field(
256-
..., description="List of tasks of the Education."
275+
None, description="List of tasks of the Education."
257276
)
258277

259278

@@ -270,67 +289,67 @@ class Attachment(BaseModel):
270289

271290

272291
class HrFlowProfile(BaseModel):
273-
key: str = Field(..., description="Identification key of the Profile.")
292+
key: str = Field(None, description="Identification key of the Profile.")
274293
reference: t.Optional[str] = Field(
275-
..., description="Custom identifier of the Profile."
294+
None, description="Custom identifier of the Profile."
276295
)
277296
info: ProfileInfo = Field(..., description="Object containing the Profile's info.")
278297
text_language: str = Field(
279298
..., description="Code language of the Profile. type: string code ISO 639-1"
280299
)
281300
text: str = Field(..., description="Full text of the Profile..")
282301
archived_at: t.Optional[str] = Field(
283-
...,
302+
None,
284303
description=(
285304
"type: datetime ISO8601, Archive date of the Profile."
286305
" The value is null for unarchived Profiles."
287306
),
288307
)
289308
updated_at: str = Field(
290-
..., description="type: datetime ISO8601, Last update date of the Profile."
309+
None, description="type: datetime ISO8601, Last update date of the Profile."
291310
)
292311
created_at: str = Field(
293-
..., description="type: datetime ISO8601, Creation date of the Profile."
312+
None, description="type: datetime ISO8601, Creation date of the Profile."
294313
)
295314
experiences_duration: float = Field(
296-
..., description="Total number of years of experience."
315+
None, description="Total number of years of experience."
297316
)
298317
educations_duration: float = Field(
299-
..., description="Total number of years of education."
318+
None, description="Total number of years of education."
300319
)
301320
experiences: t.Optional[t.List[Experience]] = Field(
302-
..., description="List of experiences of the Profile."
321+
None, description="List of experiences of the Profile."
303322
)
304323
educations: t.Optional[t.List[Education]] = Field(
305-
..., description="List of educations of the Profile."
324+
None, description="List of educations of the Profile."
306325
)
307326
attachments: t.List[Attachment] = Field(
308-
..., description="List of documents attached to the Profile."
327+
None, description="List of documents attached to the Profile."
309328
)
310329
skills: t.Optional[t.List[Skill]] = Field(
311-
..., description="List of skills of the Profile."
330+
None, description="List of skills of the Profile."
312331
)
313332
languages: t.Optional[t.List[GeneralEntitySchema]] = Field(
314-
..., description="List of spoken languages of the profile"
333+
None, description="List of spoken languages of the profile"
315334
)
316335
certifications: t.Optional[t.List[GeneralEntitySchema]] = Field(
317-
..., description="List of certifications of the Profile."
336+
None, description="List of certifications of the Profile."
318337
)
319338
courses: t.Optional[t.List[GeneralEntitySchema]] = Field(
320-
..., description="List of courses of the Profile."
339+
None, description="List of courses of the Profile."
321340
)
322341
tasks: t.Optional[t.List[GeneralEntitySchema]] = Field(
323-
..., description="List of tasks of the Profile."
342+
None, description="List of tasks of the Profile."
324343
)
325344
interests: t.Optional[t.List[GeneralEntitySchema]] = Field(
326-
..., description="List of interests of the Profile."
345+
None, description="List of interests of the Profile."
327346
)
328347
tags: t.Optional[t.List[GeneralEntitySchema]] = Field(
329-
..., description="List of tags of the Profile."
348+
None, description="List of tags of the Profile."
330349
)
331350
metadatas: t.Optional[t.List[GeneralEntitySchema]] = Field(
332-
..., description="List of metadatas of the Profile."
351+
None, description="List of metadatas of the Profile."
333352
)
334353
labels: t.Optional[t.List[GeneralEntitySchema]] = Field(
335-
..., description="List of labels of the Profile."
354+
None, description="List of labels of the Profile."
336355
)

0 commit comments

Comments
 (0)