Skip to content

Commit 64c635e

Browse files
docs: a large form example
1 parent d69e109 commit 64c635e

1 file changed

Lines changed: 388 additions & 1 deletion

File tree

src/form/models.tsp

Lines changed: 388 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,394 @@ namespace CoreSystem.Forms {
185185
}
186186

187187
@doc("Response model for listing all sections and questions in a form.")
188-
@example(#{ sections: #[] })
188+
@example(#{
189+
sections: #[
190+
#{
191+
id: "b23f2668-c2dc-4213-88fe-eceedff46398",
192+
formId: "9a843aa0-8451-4e3b-b6a0-8c0e994e9040",
193+
title: "Personal Information",
194+
description: "Please provide your basic information",
195+
questions: #[
196+
#{
197+
id: "ee894524-4bd8-4a64-8fd2-a53b39ca94cd",
198+
sectionId: "b23f2668-c2dc-4213-88fe-eceedff46398",
199+
required: true,
200+
type: QuestionTypes.shortText,
201+
title: "Full Name",
202+
description: "Please enter your full name (in English)",
203+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
204+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
205+
},
206+
#{
207+
id: "f2a1b3c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
208+
sectionId: "b23f2668-c2dc-4213-88fe-eceedff46398",
209+
required: true,
210+
type: QuestionTypes.shortText,
211+
title: "Student ID",
212+
description: "Enter your student ID number",
213+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
214+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
215+
},
216+
#{
217+
id: "a3b4c5d6-7e8f-9a0b-1c2d-3e4f5a6b7c8d",
218+
sectionId: "b23f2668-c2dc-4213-88fe-eceedff46398",
219+
required: true,
220+
type: QuestionTypes.shortText,
221+
title: "Email Address",
222+
description: "Please provide your email address",
223+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
224+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
225+
},
226+
#{
227+
id: "d4e5f6a7-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
228+
sectionId: "b23f2668-c2dc-4213-88fe-eceedff46398",
229+
required: true,
230+
type: QuestionTypes.shortText,
231+
title: "Phone Number",
232+
description: "Your contact phone number",
233+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
234+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
235+
},
236+
#{
237+
id: "e5f6a7b8-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
238+
sectionId: "b23f2668-c2dc-4213-88fe-eceedff46398",
239+
required: true,
240+
type: QuestionTypes.date,
241+
title: "Date of Birth",
242+
description: "Select your date of birth",
243+
date: #{ hasYear: true, hasMonth: true, hasDay: true, minDate: utcDateTime.fromISO("1990-01-01T00:00:00Z"), maxDate: utcDateTime.fromISO("2010-12-31T23:59:59Z") },
244+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
245+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
246+
},
247+
#{
248+
id: "f6a7b8c9-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
249+
sectionId: "b23f2668-c2dc-4213-88fe-eceedff46398",
250+
required: true,
251+
type: QuestionTypes.longText,
252+
title: "Self Introduction",
253+
description: "Tell us about yourself (200-500 words)",
254+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
255+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
256+
}
257+
],
258+
},
259+
#{
260+
id: "c34d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f",
261+
formId: "9a843aa0-8451-4e3b-b6a0-8c0e994e9040",
262+
title: "Academic & Experience",
263+
description: "Tell us about your academic background and experience",
264+
questions: #[
265+
#{
266+
id: "a7b8c9d0-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
267+
sectionId: "c34d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f",
268+
required: true,
269+
type: QuestionTypes.dropdown,
270+
title: "Current Education Level",
271+
description: "Select your current education level",
272+
choices: #[
273+
#{ id: "ch1-1", name: "Freshman" },
274+
#{ id: "ch1-2", name: "Sophomore" },
275+
#{ id: "ch1-3", name: "Junior" },
276+
#{ id: "ch1-4", name: "Senior" },
277+
#{ id: "ch1-5", name: "Graduate Student" }
278+
],
279+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
280+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
281+
},
282+
#{
283+
id: "b8c9d0e1-2f3a-4b5c-6d7e-8f9a0b1c2d3e",
284+
sectionId: "c34d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f",
285+
required: true,
286+
type: QuestionTypes.singleChoice,
287+
title: "Department/Major",
288+
description: "Select your department or major",
289+
choices: #[
290+
#{ id: "ch2-1", name: "Computer Science" },
291+
#{ id: "ch2-2", name: "Information Management" },
292+
#{ id: "ch2-3", name: "Electrical Engineering" },
293+
#{ id: "ch2-4", name: "Electronics Engineering" },
294+
#{ id: "ch2-5", name: "Other" }
295+
],
296+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
297+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
298+
},
299+
#{
300+
id: "c9d0e1f2-3a4b-5c6d-7e8f-9a0b1c2d3e4f",
301+
sectionId: "c34d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f",
302+
required: true,
303+
type: QuestionTypes.date,
304+
title: "Expected Graduation Date",
305+
description: "When do you expect to graduate?",
306+
date: #{ hasYear: true, hasMonth: true, hasDay: false, minDate: utcDateTime.fromISO("2025-01-01T00:00:00Z"), maxDate: utcDateTime.fromISO("2030-12-31T23:59:59Z") },
307+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
308+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
309+
},
310+
#{
311+
id: "d0e1f2a3-4b5c-6d7e-8f9a-0b1c2d3e4f5a",
312+
sectionId: "c34d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f",
313+
required: false,
314+
type: QuestionTypes.multipleChoice,
315+
title: "Previous Experience",
316+
description: "Select all that apply",
317+
choices: #[
318+
#{ id: "ch3-1", name: "Participated in hackathons" },
319+
#{ id: "ch3-2", name: "Open source contributor" },
320+
#{ id: "ch3-3", name: "Personal projects" },
321+
#{ id: "ch3-4", name: "Internship experience" },
322+
#{ id: "ch3-5", name: "Research assistant" },
323+
#{ id: "ch3-6", name: "None of the above" }
324+
],
325+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
326+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
327+
}
328+
],
329+
},
330+
#{
331+
id: "d45e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
332+
formId: "9a843aa0-8451-4e3b-b6a0-8c0e994e9040",
333+
title: "Technical Skills",
334+
description: "Tell us about your technical expertise",
335+
questions: #[
336+
#{
337+
id: "e1f2a3b4-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
338+
sectionId: "d45e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
339+
required: true,
340+
type: QuestionTypes.detailedMultipleChoice,
341+
title: "Programming Languages",
342+
description: "Select all programming languages you are familiar with",
343+
choices: #[
344+
#{ id: "ch4-1", name: "TypeScript/JavaScript", description: "Modern web development" },
345+
#{ id: "ch4-2", name: "Python", description: "General purpose and data science" },
346+
#{ id: "ch4-3", name: "Go", description: "Backend and systems programming" },
347+
#{ id: "ch4-4", name: "Rust", description: "Systems programming" },
348+
#{ id: "ch4-5", name: "C/C++", description: "Low-level programming" },
349+
#{ id: "ch4-6", name: "Java", description: "Enterprise applications" }
350+
],
351+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
352+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
353+
},
354+
#{
355+
id: "f2a3b4c5-6d7e-8f9a-0b1c-2d3e4f5a6b7c",
356+
sectionId: "d45e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
357+
required: true,
358+
type: QuestionTypes.linearScale,
359+
title: "Backend Development Experience",
360+
description: "Rate your backend development experience level",
361+
scale: #{ minVal: 0, maxVal: 10, minValueLabel: "Beginner", maxValueLabel: "Expert" },
362+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
363+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
364+
},
365+
#{
366+
id: "a3b4c5d6-7e8f-9a0b-1c2d-3e4f5a6b7c8d",
367+
sectionId: "d45e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
368+
required: true,
369+
type: QuestionTypes.linearScale,
370+
title: "Frontend Development Experience",
371+
description: "Rate your frontend development experience level",
372+
scale: #{ minVal: 0, maxVal: 10, minValueLabel: "Beginner", maxValueLabel: "Expert" },
373+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
374+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
375+
},
376+
#{
377+
id: "b4c5d6e7-8f9a-0b1c-2d3e-4f5a6b7c8d9e",
378+
sectionId: "d45e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
379+
required: true,
380+
type: QuestionTypes.rating,
381+
title: "DevOps & Infrastructure",
382+
description: "Rate your familiarity with DevOps practices and infrastructure",
383+
scale: #{ icon: "star", minVal: 1, maxVal: 5, minValueLabel: "Novice", maxValueLabel: "Proficient" },
384+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
385+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
386+
},
387+
#{
388+
id: "c5d6e7f8-9a0b-1c2d-3e4f-5a6b7c8d9e0f",
389+
sectionId: "d45e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
390+
required: false,
391+
type: QuestionTypes.multipleChoice,
392+
title: "Technologies You've Worked With",
393+
description: "Select all technologies you have experience with",
394+
choices: #[
395+
#{ id: "ch5-1", name: "Docker" },
396+
#{ id: "ch5-2", name: "Kubernetes" },
397+
#{ id: "ch5-3", name: "React/Vue/Angular" },
398+
#{ id: "ch5-4", name: "Node.js" },
399+
#{ id: "ch5-5", name: "PostgreSQL/MySQL" },
400+
#{ id: "ch5-6", name: "MongoDB" },
401+
#{ id: "ch5-7", name: "Redis" },
402+
#{ id: "ch5-8", name: "AWS/GCP/Azure" },
403+
#{ id: "ch5-9", name: "CI/CD (GitHub Actions, GitLab CI)" },
404+
#{ id: "ch5-10", name: "Git" }
405+
],
406+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
407+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
408+
}
409+
],
410+
},
411+
#{
412+
id: "e56f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
413+
formId: "9a843aa0-8451-4e3b-b6a0-8c0e994e9040",
414+
title: "Team Preferences",
415+
description: "Help us understand your team preferences",
416+
questions: #[
417+
#{
418+
id: "d6e7f8a9-0b1c-2d3e-4f5a-6b7c8d9e0f1a",
419+
sectionId: "e56f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
420+
required: true,
421+
type: QuestionTypes.ranking,
422+
title: "Team Preferences",
423+
description: "Rank the following teams in order of your preference (1 = most preferred)",
424+
choices: #[
425+
#{ id: "team-1", name: "Core System Team", description: "Backend API & infrastructure development" },
426+
#{ id: "team-2", name: "Clustron Team", description: "Cluster management and distributed systems" },
427+
#{ id: "team-3", name: "HPC Team", description: "High-performance computing" },
428+
#{ id: "team-4", name: "Frontend Team", description: "User interface and experience" }
429+
],
430+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
431+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
432+
},
433+
#{
434+
id: "e7f8a9b0-1c2d-3e4f-5a6b-7c8d9e0f1a2b",
435+
sectionId: "e56f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
436+
required: true,
437+
type: QuestionTypes.singleChoice,
438+
title: "Role Preference",
439+
description: "Which role are you most interested in?",
440+
choices: #[
441+
#{ id: "role-1", name: "Backend Developer" },
442+
#{ id: "role-2", name: "Frontend Developer" },
443+
#{ id: "role-3", name: "Full Stack Developer" },
444+
#{ id: "role-4", name: "DevOps Engineer" },
445+
#{ id: "role-5", name: "Data Engineer" },
446+
#{ id: "role-6", name: "System Administrator" }
447+
],
448+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
449+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
450+
},
451+
#{
452+
id: "f8a9b0c1-2d3e-4f5a-6b7c-8d9e0f1a2b3c",
453+
sectionId: "e56f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
454+
required: true,
455+
type: QuestionTypes.longText,
456+
title: "Why SDC?",
457+
description: "Why do you want to join SDC? What are your expectations?",
458+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
459+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
460+
},
461+
#{
462+
id: "a9b0c1d2-3e4f-5a6b-7c8d-9e0f1a2b3c4d",
463+
sectionId: "e56f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b",
464+
required: true,
465+
type: QuestionTypes.rating,
466+
title: "Team Collaboration",
467+
description: "How comfortable are you working in a team environment?",
468+
scale: #{ icon: "heart", minVal: 1, maxVal: 5, minValueLabel: "Prefer solo", maxValueLabel: "Love teamwork" },
469+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
470+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
471+
}
472+
],
473+
},
474+
#{
475+
id: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
476+
formId: "9a843aa0-8451-4e3b-b6a0-8c0e994e9040",
477+
title: "Availability & Additional Information",
478+
description: "Final section - availability and additional materials",
479+
questions: #[
480+
#{
481+
id: "b0c1d2e3-4f5a-6b7c-8d9e-0f1a2b3c4d5e",
482+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
483+
required: true,
484+
type: QuestionTypes.multipleChoice,
485+
title: "Weekly Availability",
486+
description: "Which days are you available each week? (Select all that apply)",
487+
choices: #[
488+
#{ id: "day-1", name: "Monday" },
489+
#{ id: "day-2", name: "Tuesday" },
490+
#{ id: "day-3", name: "Wednesday" },
491+
#{ id: "day-4", name: "Thursday" },
492+
#{ id: "day-5", name: "Friday" },
493+
#{ id: "day-6", name: "Saturday" },
494+
#{ id: "day-7", name: "Sunday" }
495+
],
496+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
497+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
498+
},
499+
#{
500+
id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
501+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
502+
required: true,
503+
type: QuestionTypes.linearScale,
504+
title: "Time Commitment",
505+
description: "How many hours per week can you commit to SDC activities?",
506+
scale: #{ minVal: 0, maxVal: 10, minValueLabel: "0-5 hours", maxValueLabel: "20+ hours" },
507+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
508+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
509+
},
510+
#{
511+
id: "d2e3f4a5-6b7c-8d9e-0f1a-2b3c4d5e6f7a",
512+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
513+
required: true,
514+
type: QuestionTypes.uploadFile,
515+
title: "Resume/CV",
516+
description: "Please upload your resume or CV",
517+
uploadFile: #{ allowedFileTypes: #[allowedFileTypes.pdf, allowedFileTypes.doc, allowedFileTypes.docx], maxFileAmount: 1, maxFileSizeLimit: 5242880 },
518+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
519+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
520+
},
521+
#{
522+
id: "e3f4a5b6-7c8d-9e0f-1a2b-3c4d5e6f7a8b",
523+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
524+
required: false,
525+
type: QuestionTypes.uploadFile,
526+
title: "Portfolio/Projects",
527+
description: "Upload any relevant portfolio materials or project documentation (optional)",
528+
uploadFile: #{ allowedFileTypes: #[allowedFileTypes.pdf, allowedFileTypes.zip], maxFileAmount: 3, maxFileSizeLimit: 10485760 },
529+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
530+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
531+
},
532+
#{
533+
id: "f4a5b6c7-8d9e-0f1a-2b3c-4d5e6f7a8b9c",
534+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
535+
required: false,
536+
type: QuestionTypes.hyperlink,
537+
title: "GitHub Profile",
538+
description: "Link to your GitHub profile (if available)",
539+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
540+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
541+
},
542+
#{
543+
id: "a5b6c7d8-9e0f-1a2b-3c4d-5e6f7a8b9c0d",
544+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
545+
required: false,
546+
type: QuestionTypes.hyperlink,
547+
title: "LinkedIn Profile",
548+
description: "Link to your LinkedIn profile (optional)",
549+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
550+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
551+
},
552+
#{
553+
id: "b6c7d8e9-0f1a-2b3c-4d5e-6f7a8b9c0d1e",
554+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
555+
required: false,
556+
type: QuestionTypes.hyperlink,
557+
title: "Personal Website/Blog",
558+
description: "Link to your personal website or blog (if any)",
559+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
560+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
561+
},
562+
#{
563+
id: "c7d8e9f0-1a2b-3c4d-5e6f-7a8b9c0d1e2f",
564+
sectionId: "f67a8b9c-0d1e-2f3a-4b5c-6d7e8f9a0b1c",
565+
required: false,
566+
type: QuestionTypes.longText,
567+
title: "Anything Else?",
568+
description: "Is there anything else you'd like us to know?",
569+
createdAt: utcDateTime.fromISO("2025-01-20T10:00:00Z"),
570+
updatedAt: utcDateTime.fromISO("2025-02-01T15:30:00Z"),
571+
}
572+
],
573+
}
574+
]
575+
})
189576
model ListSectionsResponse {
190577
sections: Section[];
191578
}

0 commit comments

Comments
 (0)