Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client-fetch: array of string in body unsupported #673

Closed
mlankamp opened this issue Jun 13, 2024 · 0 comments · Fixed by #674
Closed

client-fetch: array of string in body unsupported #673

mlankamp opened this issue Jun 13, 2024 · 0 comments · Fixed by #674
Labels
bug 🔥 Something isn't working

Comments

@mlankamp
Copy link
Contributor

mlankamp commented Jun 13, 2024

Description

When I use the @hey-api/client-fetch client, and the request body is an array of string there is a typescript error:

Argument of type '{ url: string; headers?: Record<string, unknown> | HeadersInit | undefined; method?: "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE" | undefined; ... 19 more ...; body?: string[] | undefined; }' is not assignable to parameter of type 'RequestOptionsBase'.
  Types of property 'body' are incompatible.
    Type 'string[] | undefined' is not assignable to type 'Record<string, unknown> | BodyInit | Record<string, unknown>[] | null | undefined'.
      Type 'string[]' is not assignable to type 'Record<string, unknown> | BodyInit | Record<string, unknown>[] | null | undefined'.
        Type 'string[]' is not assignable to type 'Record<string, unknown>[]'.
          Type 'string' is not assignable to type 'Record<string, unknown>'.

OpenAPI specification (optional)

openapi: 3.0.1
info:
  title: Testing
  version: v1
paths:
  '/demo/{id}':
    post:
      tags:
        - Testing
      operationId: DeleteMultiple
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                format: uuid
      responses:
        '204':
          description: No Content

Configuration

import { defineConfig } from '@hey-api/openapi-ts';

export default defineConfig({
  input: 'source/swagger.yaml',
  output: {
    path: 'output',
    format: false,
    lint: false
  } ,
  client: '@hey-api/client-fetch',
  schemas: false,
  types: {
    enums: 'javascript'
  },
  services: {
    asClass: true,
  }
});

System information (optional)

See: https://github.com/mlankamp/openapi

Probable solution:
add Array<unknown> to

@mlankamp mlankamp added the bug 🔥 Something isn't working label Jun 13, 2024
mlankamp added a commit to mlankamp/openapi-ts that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant