client-fetch: array of string in body unsupported
mlankamp opened this issue · comments
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