Skip to content

'deepObject' is missing from ArrayStyle in all client bundles #3868

@Eddie344

Description

@Eddie344

Bug description

ArrayStyle does not include 'deepObject' in any client bundle, which causes a TypeScript compile error when the generated sdk.gen.ts uses deepObject style for array query parameters.

Error

error TS2322: Type '{ parameters: { products: { array: { style: "deepObject"; }; }; }; }' is not assignable to type 'QuerySerializerOptions | QuerySerializer | undefined'.
  Types of property 'parameters' are incompatible.
    Type '{ products: { array: { style: "deepObject"; }; }; }' is not assignable to type 'Record<string, QuerySerializerOptionsObject>'.
      Property 'products' is incompatible with index signature.
        Type '{ array: { style: "deepObject"; }; }' is not assignable to type 'QuerySerializerOptionsObject'.
          The types of 'array.style' are incompatible between these types.
            Type '"deepObject"' is not assignable to type 'ArrayStyle | undefined'.

Root cause

ArrayStyle is defined as 'form' | 'spaceDelimited' | 'pipeDelimited' in every client bundle:

  • packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/pathSerializer.ts (shared by fetch/axios/ky/ofetch)
  • packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/types.ts
  • packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/utils.ts
  • packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/utils.ts
  • packages/custom-client/src/core/pathSerializer.ts

When an OpenAPI spec uses style: deepObject on an array parameter, the generator correctly emits style: 'deepObject' in sdk.gen.ts, but the type doesn't allow it — causing a TypeScript compile error in the generated output.

Fix

Add 'deepObject' to ArrayStyle in all client bundles:

type ArrayStyle = 'deepObject' | 'form' | 'spaceDelimited' | 'pipeDelimited';

The generator already produces the correct output. Users who need bracket notation serialisation (products[0]=...) can provide a custom querySerializer.

PR

#3818

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Broken or incorrect behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions