Skip to content

ContractorOnboarding creates the employment without the partner's basic_information schema version #1456

Description

@gabrielseco

useContractorOnboarding calls useCreateEmployment() with no options (src/flows/ContractorOnboarding/hooks.tsx:289), so POST /v1/employments always sends json_schema_version=1, Onboarding's DEFAULT_VERSION.

The schema itself is fetched with getBasicInformationSchemaVersion(options) from ContractorOnboarding/utils.ts, which respects options.jsonSchemaVersion.employment_basic_information.

Failure scenario: a partner passes jsonSchemaVersion: { employment_basic_information: 2 } (or 'latest'). The form renders and validates against v2, but the create request asks the backend to validate against v1. Fields added in v2 could be rejected or dropped.

Today both defaults are 1, so partners on the default version aren't affected.

Suggested fix: pass the flow's options through, e.g. useCreateEmployment(options as $TSFixMe), the same way useUpdateEmployment already gets them on the next line. Then add a test that asserts the query param on the create request.

Found while reviewing #1455.

🤖 Generated with Claude Code

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions