- method: "GET" path: "/" conditionalResponses: - conditions: query: size: "small" response: status: 200 headers: Content-Type: "application/json" body: rooms: - id: "g5-1" name: "G5:1" capacity: 5 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@14:00}" end: "{datetime+0d@16:00}" - start: "{datetime+1d@09:00}" end: "{datetime+1d@12:00}" - start: "{datetime+1d@15:00}" end: "{datetime+1d@17:00}" - id: "g5-2" name: "G5:2" capacity: 5 bookings: - start: "{datetime+0d@09:00}" end: "{datetime+0d@12:00}" - start: "{datetime+0d@13:00}" end: "{datetime+0d@15:00}" - start: "{datetime+1d@08:00}" end: "{datetime+1d@11:00}" - start: "{datetime+1d@14:00}" end: "{datetime+1d@16:00}" - id: "g5-3" name: "G5:3" capacity: 5 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@16:00}" end: "{datetime+0d@18:00}" - start: "{datetime+1d@09:00}" end: "{datetime+1d@12:00}" - start: "{datetime+1d@17:00}" end: "{datetime+1d@19:00}" - id: "g5-4" name: "G5:4" capacity: 5 bookings: - start: "{datetime+0d@09:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@14:00}" end: "{datetime+0d@16:00}" - start: "{datetime+1d@09:00}" end: "{datetime+1d@12:00}" - start: "{datetime+1d@18:00}" end: "{datetime+1d@20:00}" - id: "g5-5" name: "G5:5" capacity: 5 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@17:00}" end: "{datetime+0d@19:00}" - start: "{datetime+1d@09:00}" end: "{datetime+1d@11:00}" - start: "{datetime+1d@16:00}" end: "{datetime+1d@18:00}" maxBookableLength: "PT4H" earliestBookingTime: "08:00:00" latestBookingTime: "20:00:00" minimumParticipants: 2 maxDaysInFuture: 14 - conditions: query: size: "large" response: status: 200 headers: Content-Type: "application/json" body: rooms: - id: "g10-1" name: "G10:1" capacity: 10 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@14:00}" end: "{datetime+0d@17:00}" - start: "{datetime+1d@13:00}" end: "{datetime+1d@16:00}" - start: "{datetime+1d@18:00}" end: "{datetime+1d@20:00}" - id: "g10-2" name: "G10:2" capacity: 10 bookings: - start: "{datetime+0d@09:00}" end: "{datetime+0d@12:00}" - start: "{datetime+0d@15:00}" end: "{datetime+0d@18:00}" - start: "{datetime+1d@14:00}" end: "{datetime+1d@17:00}" - start: "{datetime+1d@18:00}" end: "{datetime+1d@20:00}" - id: "g10-3" name: "G10:3" capacity: 10 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@14:00}" end: "{datetime+0d@17:00}" - start: "{datetime+1d@13:00}" end: "{datetime+1d@15:00}" - start: "{datetime+1d@17:00}" end: "{datetime+1d@20:00}" - id: "g10-4" name: "G10:4" capacity: 10 bookings: - start: "{datetime+0d@09:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@14:00}" end: "{datetime+0d@16:00}" - start: "{datetime+1d@14:00}" end: "{datetime+1d@16:00}" - start: "{datetime+1d@18:00}" end: "{datetime+1d@20:00}" - id: "g10-5" name: "G10:5" capacity: 10 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@10:00}" - start: "{datetime+0d@13:00}" end: "{datetime+0d@16:00}" - start: "{datetime+1d@13:00}" end: "{datetime+1d@16:00}" - start: "{datetime+1d@17:00}" end: "{datetime+1d@19:00}" maxBookableLength: "PT4H" earliestBookingTime: "08:00:00" latestBookingTime: "20:00:00" minimumParticipants: 2 maxDaysInFuture: 14 response: status: 200 headers: Content-Type: "application/json" body: rooms: - id: "1" name: "G5:1" capacity: 5 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@09:30}" - start: "{datetime+0d@11:00}" end: "{datetime+0d@13:00}" - start: "{datetime+0d@15:00}" end: "{datetime+0d@17:00}" - id: "2" name: "G5:2" capacity: 5 bookings: - start: "{datetime+0d@09:00}" end: "{datetime+0d@11:00}" - start: "{datetime+0d@14:00}" end: "{datetime+0d@16:00}" - start: "{datetime+0d@18:00}" end: "{datetime+0d@20:00}" - id: "3" name: "G5:3" capacity: 8 bookings: - start: "{datetime+0d@08:00}" end: "{datetime+0d@10:00}" - start: "{datetime+0d@12:00}" end: "{datetime+0d@14:00}" - start: "{datetime+0d@16:30}" end: "{datetime+0d@18:30}" - id: "4" name: "G10:1" capacity: 12 bookings: - start: "{datetime+0d@10:00}" end: "{datetime+0d@12:00}" - start: "{datetime+0d@13:00}" end: "{datetime+0d@15:00}" maxBookableLength: "PT4H" earliestBookingTime: "08:00:00" latestBookingTime: "20:00:00" minimumParticipants: 2 maxDaysInFuture: 14 - method: "POST" path: "/" conditionalResponses: # Test error: Forbidden - Swedish - conditions: headers: Accept-Language: "sv-SE" body: name: "[TEST:forbidden]" response: status: 403 headers: Content-Type: "application/problem+json" Content-Language: "sv-SE" body: type: "daisy:forbidden" title: "Förbjuden" detail: "Du har inte behörighet att boka rum just nu" # Test error: Forbidden - English (default) - conditions: body: name: "[TEST:forbidden]" response: status: 403 headers: Content-Type: "application/problem+json" Content-Language: "en" body: type: "daisy:forbidden" title: "Forbidden" detail: "You are not allowed to book rooms at this time" # Test error: Duration too long - Swedish - conditions: headers: Accept-Language: "sv-SE" body: name: "[TEST:duration]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "sv-SE" body: type: "daisy:duration-too-long" title: "För lång bokning" detail: "Bokningens längd överskrider maxgränsen (4 timmar)" # Test error: Duration too long - English (default) - conditions: body: name: "[TEST:duration]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "en" body: type: "daisy:duration-too-long" title: "Duration too long" detail: "Booking duration exceeds maximum allowed (4 hours)" # Test error: Too few participants - Swedish - conditions: headers: Accept-Language: "sv-SE" body: name: "[TEST:participants]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "sv-SE" body: type: "daisy:too-few-participants" title: "För få deltagare" detail: "Minst 2 deltagare krävs" # Test error: Too few participants - English (default) - conditions: body: name: "[TEST:participants]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "en" body: type: "daisy:too-few-participants" title: "Too few participants" detail: "At least 2 participants are required" # Test error: Validation errors - Swedish - conditions: headers: Accept-Language: "sv-SE" body: name: "[TEST:validation]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "sv-SE" body: type: "daisy:bad-request" title: "Validering misslyckades" detail: "Ett eller flera fält är ogiltiga" violations: name: "Titeln innehåller ogiltiga tecken" additional_participants: "En eller flera e-postadresser är ogiltiga" # Test error: Validation errors - English (default) - conditions: body: name: "[TEST:validation]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "en" body: type: "daisy:bad-request" title: "Validation failed" detail: "One or more fields are invalid" violations: name: "Title contains invalid characters" additional_participants: "One or more participant emails are invalid" # Test error: Validation error on title - Swedish - conditions: headers: Accept-Language: "sv-SE" body: name: "[TEST:validation:title]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "sv-SE" body: type: "daisy:bad-request" title: "Validering misslyckades" detail: "Titeln är ogiltig" violations: name: "Titeln innehåller ogiltiga tecken" # Test error: Validation error on title - English (default) - conditions: body: name: "[TEST:validation:title]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "en" body: type: "daisy:bad-request" title: "Validation failed" detail: "Title is invalid" violations: name: "Title contains invalid characters" # Test error: Validation error on participants - Swedish - conditions: headers: Accept-Language: "sv-SE" body: name: "[TEST:validation:participants]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "sv-SE" body: type: "daisy:bad-request" title: "Validering misslyckades" detail: "Deltagarna är ogiltiga" violations: additional_participants: "En eller flera e-postadresser är ogiltiga" # Test error: Validation error on participants - English (default) - conditions: body: name: "[TEST:validation:participants]" response: status: 400 headers: Content-Type: "application/problem+json" Content-Language: "en" body: type: "daisy:bad-request" title: "Validation failed" detail: "Participants are invalid" violations: additional_participants: "One or more participant emails are invalid" response: status: 200 headers: Content-Type: "application/json" body: booking_id: "booking-12345" name: "Test booking" room_name: "G5:7" start_time: "{datetime+1d@10:00}" end_time: "{datetime+1d@12:00}" additional_participants: - "participant1@su.se" - "participant2@su.se" booked_by: "dev@localhost" - method: "GET" path: "/mine" response: status: 200 headers: Content-Type: "application/json" body: - booking_id: "bk-20251025-001" name: "Team standup" room_name: "G5:1" start_time: "{datetime+1d@08:00}" end_time: "{datetime+1d@09:00}" additional_participants: - "kaan8888@su.se" - "joan7777@su.se" booked_by: "dev@localhost" - booking_id: "bk-20251025-002" name: "Study session" room_name: "G5:3" start_time: "{datetime+3d@14:00}" end_time: "{datetime+3d@16:00}" additional_participants: - "stud1234@su.se" - "stud5678@su.se" booked_by: "dev@localhost" - booking_id: "bk-20251025-003" name: "Project work" room_name: "G10:2" start_time: "{datetime+5d@10:00}" end_time: "{datetime+5d@13:00}" additional_participants: - "emma9999@su.se" - "oliver1111@su.se" - "sofia2222@su.se" booked_by: "other@su.se" - booking_id: "bk-20251025-004" name: "Exam preparation" room_name: "G5:4" start_time: "{datetime+7d@15:00}" end_time: "{datetime+7d@18:00}" additional_participants: - "lucas3333@su.se" - "alice4444@su.se" booked_by: "dev@localhost" - booking_id: "bk-20251025-005" name: "Group presentation practice" room_name: "G10:3" start_time: "{datetime+10d@11:00}" end_time: "{datetime+10d@15:00}" additional_participants: - "noah5555@su.se" - "mia6666@su.se" - "elias7777@su.se" - "liam8888@su.se" booked_by: "dev@localhost" - method: "PUT" path: "/{booking_id}" response: status: 200 headers: Content-Type: "application/json" body: booking_id: "{booking_id}" name: "Updated booking" room_name: "G5:7" start_time: "{datetime+1d@10:00}" end_time: "{datetime+1d@12:00}" additional_participants: - "updated@su.se" booked_by: "dev@localhost" - method: "DELETE" path: "/{booking_id}" response: status: 204 headers: Content-Type: "application/json"