Skip to content

Confirm registration questions payload keys align with SahajCloud's EVENT_REGISTRATION_QUESTIONS #60

Closed

Description

@Ardnived

Context

SahajCloud PR sydevs/SahajCloud#594 (issue #588) adds a manager-facing registration-notification email that forwards the registrant's answers to the event's registration questions. As part of it, the Registrations.questions field is now typed and validated on SahajCloud:

  • Keys must be members of EVENT_REGISTRATION_QUESTIONS: priorExperience, referralSource, healthInfo, accessibility, guests.
  • Values must be strings.
  • A non-conforming payload throws a ValidationError, which POST /api/events/:id/register surfaces as a 400 (previously the blob was stored unvalidated).

This ticket is to confirm the widget's questions payload matches that contract before it ships, so live registrations don't start 400-ing.

What the widget does today (looks aligned ✅)

From a read of this repo:

  • src/views/RegistrationView/RegistrationView.tsx — enabledQuestions(event) derives the enabled question names from event.registrationQuestions (Object.entries(...).filter(enabled).map(([key]) => key)) and passes them as the questions prop.
  • src/components/organisms/RegistrationForm/RegistrationForm.tsx — registers each field as questions.<name> (and localises via t('questions.<name>')).
  • src/config/api/mutate.ts — submits questions: data.questions.
  • src/types/event.ts — RegistrationQuestionsSchema uses exactly priorExperience / referralSource / healthInfo / accessibility / guests.

So the widget already appears to send { <question name>: <string answer> } keyed by the EVENT_REGISTRATION_QUESTIONS names — which matches the new SahajCloud contract.

Please confirm / consider

  1. Keys — confirm nothing other than the five EVENT_REGISTRATION_QUESTIONS names can ever end up in the submitted questions object.
  2. Values — confirm answers are always strings. src/types/registration.ts currently types this loosely as questions: z.record(z.string()).optional(); consider tightening the key set to the known names for client-side validation + type safety.
  3. Unanswered enabled questions — does the form submit empty strings or omit the key? Both are accepted by SahajCloud (an empty string is valid, and blank answers are dropped from the notification email), but worth confirming the intended UX.
  4. Stale generated types — src/types/payload/payload-types.ts and src/types/payload/openapi.json still describe questions with the old placeholder keys ("questions / experience / aspirations / referral"). Regenerating against the updated SahajCloud OpenAPI (once #594 merges) will refresh that description.

References

🤖 Filed with Claude Code on behalf of the SahajCloud #588 work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions