diff --git a/samples/empty-object-response-body/$api.ts b/samples/empty-object-response-body/$api.ts index ee83b6a1..c8139fd5 100644 --- a/samples/empty-object-response-body/$api.ts +++ b/samples/empty-object-response-body/$api.ts @@ -38,10 +38,16 @@ const api = ({ baseURL, fetch }: AspidaClient) => { $path: () => `${prefix}${PATH1}`, }, without_additional_properties: { + /** + * @returns OK + */ delete: (option?: { config?: T | undefined } | undefined) => - fetch(prefix, PATH2, DELETE, option).send(), + fetch(prefix, PATH2, DELETE, option).json(), + /** + * @returns OK + */ $delete: (option?: { config?: T | undefined } | undefined) => - fetch(prefix, PATH2, DELETE, option).send().then(r => r.body), + fetch(prefix, PATH2, DELETE, option).json().then(r => r.body), $path: () => `${prefix}${PATH2}`, }, }; diff --git a/samples/empty-object-response-body/without-additional-properties/$api.ts b/samples/empty-object-response-body/without-additional-properties/$api.ts index 37fa16ba..c158d097 100644 --- a/samples/empty-object-response-body/without-additional-properties/$api.ts +++ b/samples/empty-object-response-body/without-additional-properties/$api.ts @@ -7,10 +7,16 @@ const api = ({ baseURL, fetch }: AspidaClient) => { const DELETE = 'DELETE'; return { + /** + * @returns OK + */ delete: (option?: { config?: T | undefined } | undefined) => - fetch(prefix, PATH0, DELETE, option).send(), + fetch(prefix, PATH0, DELETE, option).json(), + /** + * @returns OK + */ $delete: (option?: { config?: T | undefined } | undefined) => - fetch(prefix, PATH0, DELETE, option).send().then(r => r.body), + fetch(prefix, PATH0, DELETE, option).json().then(r => r.body), $path: () => `${prefix}${PATH0}`, }; }; diff --git a/samples/empty-object-response-body/without-additional-properties/index.ts b/samples/empty-object-response-body/without-additional-properties/index.ts index b9ef8999..c68852f3 100644 --- a/samples/empty-object-response-body/without-additional-properties/index.ts +++ b/samples/empty-object-response-body/without-additional-properties/index.ts @@ -2,5 +2,9 @@ export type Methods = { delete: { status: 200 + + /** OK */ + resBody: { + } } } diff --git a/samples/openapi/api/v3/channels/_channelId@string/chats/_chatId@string/items/index.ts b/samples/openapi/api/v3/channels/_channelId@string/chats/_chatId@string/items/index.ts index b2cd7ee0..0d44140f 100644 --- a/samples/openapi/api/v3/channels/_channelId@string/chats/_chatId@string/items/index.ts +++ b/samples/openapi/api/v3/channels/_channelId@string/chats/_chatId@string/items/index.ts @@ -16,6 +16,8 @@ export type Methods = { resBody: { limit: number offset: number + data: { + }[] } } diff --git a/samples/openapi/api/v3/chats/_chatId@string/items/index.ts b/samples/openapi/api/v3/chats/_chatId@string/items/index.ts index b81bab07..46be4b24 100644 --- a/samples/openapi/api/v3/chats/_chatId@string/items/index.ts +++ b/samples/openapi/api/v3/chats/_chatId@string/items/index.ts @@ -18,6 +18,8 @@ export type Methods = { resBody: { limit: number offset: number + data: { + }[] } } diff --git a/src/builderUtils/converters.ts b/src/builderUtils/converters.ts index f519be8b..df8b68d6 100644 --- a/src/builderUtils/converters.ts +++ b/src/builderUtils/converters.ts @@ -123,11 +123,11 @@ export const schema2value = ( } else if (isArraySchema(schema)) { isArray = true; value = schema2value(schema.items); - } else if (schema.properties || 'additionalProperties' in schema) { + } else if (schema.type === 'object' || schema.properties || 'additionalProperties' in schema) { value = object2value(schema); } else if (schema.format === 'binary') { value = isResponse ? 'Blob' : BINARY_TYPE; - } else if (schema.type !== 'object') { + } else { value = schema.type ? { integer: 'number',