Send a question's time of day as time_of_day
What
CreateQuestion and UpdateQuestion now send the schedule's time as time_of_day, the field Basecamp reads, instead of hour and minute. The spec gives both operations a new QuestionScheduleInput holding exactly the schedule fields Basecamp permits, and every SDK is regenerated from it. The response keeps QuestionSchedule, with its hour and minute. Go's hand-written CreateQuestionRequest and UpdateQuestionRequest take a matching QuestionScheduleInput.
Why
bc3's QuestionsController#question_params permits:
params.require(:question).permit(:title, schedule: [ :frequency, :time_of_day, :week_instance, :start_date, :days, days: [] ])
hour and minute are dropped, so the schedule reaches RecurrenceSchedule without a time and fails its hour validation. Every create answered 422, and so did any update that sent a schedule. bc3's API doc ("Create a question", "Update a question") names time_of_day; the spec had used the response shape for the request. Found from basecamp checkins question create, which has failed this way since at least CLI 0.11.0.
QuestionScheduleInput has only the fields Basecamp permits. week_interval, month_interval and end_date were dropped on a write too, so they go from the input rather than being mapped.
Breaking
Yes, source-breaking in every typed SDK. The request's schedule type changes; see the new # Unreleased section in MIGRATING.md. Nothing that worked stops working, since a schedule sent with hour and minute was always refused. Go's generated response type QuestionSchedule.Days becomes []int32 instead of *[]int32, because the generator drops the pointer on response-only types. That matters only to code reading generated.QuestionSchedule directly. Release-note section: Breaking Changes plus Bug Fixes (breaking, bug).
Basecamp also replaces a question's whole schedule on update, so a caller updating one part has to send the rest. This PR doesn't change that, but MIGRATING.md says so. A merge-safe UpdateQuestion composite, like the Todos one, would be the follow-up.
Testing
- Go:
TestCheckinsService_QuestionScheduleSendsTimeOfDayasserts create and update puttime_of_dayon the wire and nohourorminute; it didn't compile before the spec change. The existing exact-wire golden tests now pin the input shape. - TypeScript's typecheck now rejects
hourin a request, and caught a test that sent it; that test and the Ruby create test usetime_of_daynow. make generate, thenmake checkpasses locally (all seven SDKs, drift checks, conformance).- Live against a local bc3 dev, through basecamp-cli built on this branch: create with the default and with
--time 9:30amstored 17:00 and 9:30, and updates of the time, frequency and days took. The same calls on v0.22.0 answered422.
basecamp-cli follows in a separate PR once this is released.
Summary by cubic
CreateQuestion and UpdateQuestion now send a question's schedule time as time_of_day instead of hour and minute, fixing a bug where every create and any update that sent a schedule was rejected with 422.
The spec now gives both operations a QuestionScheduleInput with exactly the fields Basecamp permits (frequency, days, time_of_day, week_instance, start_date), and every SDK is regenerated from it. The response keeps QuestionSchedule with its hour and minute. Go's handwritten CreateQuestionRequest and UpdateQuestionRequest take the new input type.
Migration
Source-breaking in every typed SDK: request schedule types change from QuestionSchedule to QuestionScheduleInput, so set time_of_day instead of hour/minute, and week_interval, month_interval, and end_date are no longer writable. Nothing that worked stops working. Go's QuestionSchedule.Days becomes []int32 instead of *[]int32. Basecamp also replaces a question's whole schedule on update, so send every part of it, not only the field you're changing.